tensorflow c++ API与QT5.9.6冲突解决

在将tensorflow c++编译好的动态库用于QT项目中时遇到了三个问题,现在介绍解决办法:

1、编译时报错:qint32、Qvector等类型没有定义,找不到定义之类的。

解决:应该是libtensorflow_cc.so与QT冲突,将tensorflow作用域范围缩小,即不要使用using namespace tensorflow::xxx之类的,用到xxx的地方再加上tensorflow:: 这样虽然麻烦,但的确解决了这个问题。

2、与libmir(好像是这样拼写的,类似这样的库,忘了)、libprotobuf版本冲突,会报与此相关的错。

解决:删掉/opt/Qt5.9.x/5.9.x/gcc_64/plugins/platformthemes/这个路径下的库libgtk3.0,问题解决,但带来一个小现象,软件界面字体变小一号,我觉得不影响功能,就没管。

3、pthread_rwlock_wrlock.c:no such file or directory 好像是libQt5Network.so.5与libtensorflow_framework.so.2导致。

解决:不要使用QNetworkAccessManage->post()这个函数,具体原因我还不知道。反正这个函数是在一个项目未完成的功能里使用的,这个未完成的功能以后再想办法实现算了,我把这个函数删掉了,不影响功能,反正删掉这句就解决了这个问题。

 

 

 

今天将CNN用于另一个项目,出现:

/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h: In static member function ‘static void Eigen::internal::TensorBlockIO<Scalar, StorageIndex, NumDims, Layout, BlockRead>::Copy(const Block&, StorageIndex, const Dimensions&, const Dimensions&, const Scalar*, Scalar*)’:
/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h:393:63: error: the value of ‘j’ is not usable in a constant expression
         if (++block_iter_state[j].count < block_iter_state[j].size) {
                                                               ^
/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h:392:16: note: ‘int j’ is not const
       for (int j = 0; j < num_squeezed_dims; ++j) {
                ^
/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h:393:35: error: parse error in template argument list
         if (++block_iter_state[j].count < block_iter_state[j].size) {
                                   ^
/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h: In static member function ‘static void Eigen::internal::TensorBlockCwiseUnaryIO<UnaryFunctor, StorageIndex, OutputScalar, NumDims, Layout>::Run(const UnaryFunctor&, const Dimensions&, const Dimensions&, OutputScalar*, Eigen::array<StorageIndex, NumDims>&, const InputScalar*)’:
/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h:604:21: error: parse error in template argument list
         if (++state.count < state.size) {
                     ^
/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h: In static member function ‘static void Eigen::internal::TensorBlockCwiseBinaryIO<BinaryFunctor, StorageIndex, OutputScalar, NumDims, Layout>::Run(const BinaryFunctor&, const Dimensions&, const Dimensions&, OutputScalar*, Eigen::array<StorageIndex, NumDims>&, const LeftScalar*, Eigen::array<StorageIndex, NumDims>&, const RightScalar*)’:
/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h:758:21: error: parse error in template argument list
         if (++state.count < state.size) {
                     ^
In file included from /home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/Tensor:143:0,
                 from /home/jumper/ThirdPartyLib/tensorflow_cc/include/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /home/jumper/ThirdPartyLib/tensorflow_cc/include/tensorflow/core/framework/tensor.h:21,
                 from /home/jumper/ThirdPartyLib/tensorflow_cc/include/tensorflow/cc/framework/ops.h:21,
                 from /home/jumper/ThirdPartyLib/tensorflow_cc/include/tensorflow/cc/ops/const_op.h:19,
                 from /root/文档/jinxing/XRT_server_sortingprocessV2.0.2-Release/ExtraDependency/include/jinXingCnn.h:25,
                 from /root/文档/jinxing/XRT_server_sortingprocessV2.0.2-Release/ExtraDependency/include/DualEnFitOreStoneRecogProc.h:16,
                 from /root/文档/jinxing/XRT_server_sortingprocessV2.0.2-Release/ExtraDependency/include/XRT_PC_Stream_Mathprocess.h:11,
                 from ../src/CameraDataProcessThread.h:50,
                 from ../src/CameraDataProcessThread.cpp:14:
/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h: In member function ‘void Eigen::TensorEvaluator<const Eigen::TensorReshapingOp<NewDimensions, XprType>, Device>::block(Eigen::TensorEvaluator<const Eigen::TensorReshapingOp<NewDimensions, XprType>, Device>::OutputTensorBlock*) const’:
/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h:319:35: error: parse error in template argument list
         if (++block_iter_state[i].count < block_iter_state[i].size) {
                                   ^
In file included from /home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/Tensor:151:0,
                 from /home/jumper/ThirdPartyLib/tensorflow_cc/include/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
                 from /home/jumper/ThirdPartyLib/tensorflow_cc/include/tensorflow/core/framework/tensor.h:21,
                 from /home/jumper/ThirdPartyLib/tensorflow_cc/include/tensorflow/cc/framework/ops.h:21,
                 from /home/jumper/ThirdPartyLib/tensorflow_cc/include/tensorflow/cc/ops/const_op.h:19,
                 from /root/文档/jinxing/XRT_server_sortingprocessV2.0.2-Release/ExtraDependency/include/jinXingCnn.h:25,
                 from /root/文档/jinxing/XRT_server_sortingprocessV2.0.2-Release/ExtraDependency/include/DualEnFitOreStoneRecogProc.h:16,
                 from /root/文档/jinxing/XRT_server_sortingprocessV2.0.2-Release/ExtraDependency/include/XRT_PC_Stream_Mathprocess.h:11,
                 from ../src/CameraDataProcessThread.h:50,
                 from ../src/CameraDataProcessThread.cpp:14:
/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h: In member function ‘void Eigen::TensorEvaluator<const Eigen::TensorGeneratorOp<Generator, XprType>, Device>::block(Eigen::TensorEvaluator<const Eigen::TensorGeneratorOp<Generator, XprType>, Device>::TensorBlock*) const’:
/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h:202:28: error: parse error in template argument list
     while (it[NumDims - 1].count < it[NumDims - 1].size) {
                            ^
/home/jumper/ThirdPartyLib/tensorflow_cc/include/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h:216:21: error: parse error in template argument list
         if (++it[i].count < it[i].size) {

我查了下,也是冲突问题,至于具体冲突我还在查......

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

元气少女缘结神

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值