0

I am trying to write a code in C++ using the Eclipse IDE without Bazel. To get my project to do this I had to perform some hacks to generate the Tensorflow C++ APIs. Tensorflow C++ seems to be working fine. I can load a model and perform predictions. I have another code that uses a Caffe library to do something else. These both seem to work fine separately.

The Problem

I want to integrate BOTH Tensorflow and Caffe in my code. When I include both libraries I get the following issue:

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
 }

what it seems is happening is that both glog and tensorflow seem to define the same thing for LOG(for example).

Is there a way to solve this issue? Any help is appreciated.

Thank you.

Community
  • 1
  • 1
Y. Reznichenko
  • 153
  • 2
  • 13

1 Answers1

0

So, if anyone has this issue my solution was this:

Add

'#ifndef LOG_....etc'

//Define state that gets redefined

'#endif'

And DO NOT INCLUDE

"#Xlib.h"

as this defines Session which conflicts with Session defined in tensorflow C++.

Community
  • 1
  • 1
Y. Reznichenko
  • 153
  • 2
  • 13