我正在尝试使用没有Bazel的Eclipse IDE在C ++中编写代码。为了让我的项目能够做到这一点,我不得不执行一些黑客来生成Tensorflow C ++ API。 Tensorflow C ++似乎运行良好。我可以加载模型并执行预测。我有另一个代码,使用Caffe库来做其他事情。这两者似乎都可以单独使用。
我想在我的代码中集成Tensorflow和Caffe。当我包含这两个库时,我会遇到以下问题:
In file included from /usr/local/include/tf/tensorflow/core/platform/logging.h:25:0,
from /usr/local/include/tf/tensorflow/core/lib/core/status.h:25,
from /usr/local/include/tf/tensorflow/core/framework/variant.h:28,
from /usr/local/include/tf/tensorflow/core/framework/allocator.h:26,
from /usr/local/include/tf/tensorflow/core/framework/tensor.h:22,
from /usr/local/include/tf/tensorflow/cc/framework/ops.h:21,
from /usr/local/include/tf/tensorflow/cc/ops/const_op.h:19,
/usr/local/include/tf/tensorflow/core/platform/default/logging.h:87:0: warning: "LOG" redefined [enabled by default]
#define LOG(severity) _TF_LOG_##severity
^
In file included from /bin/caffe-master/distribute/include/caffe/common.hpp:6:0,
from /bin/caffe-master/distribute/include/caffe/blob.hpp:8,
from /bin/caffe-master/distribute/include/caffe/caffe.hpp:7,
class Status {
/usr/local/include/tf/tensorflow/core/lib/core/status.h:37:14: error: expected unqualified-id before ‘{’ token
../ME_T42.cpp:2862:1: error: expected ‘}’ at end of input
}
似乎正在发生的事情是glog和tensorflow似乎都为LOG定义了相同的东西(例如)。
有没有办法解决这个问题? 任何帮助表示赞赏。
谢谢。
答案 0 :(得分:0)
所以,如果有人遇到这个问题我的解决方案是:
添加
'#ifndef LOG _.... etc'
//定义重新定义的状态
'#ENDIF'
“#Xlib.h”
因为它定义了Session,它与tensorflow C ++中定义的Session冲突。