我正在尝试使用没有 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 定义了相同的东西(例如)。
有没有办法解决这个问题?任何帮助表示赞赏。
谢谢你。