cerebrou
cerebrou

Reputation: 5540

PYTHONPATH counterpart for importing C++ libraries

I am trying to rewrite the pycaffe code using C++ Caffe API. However, I get stuck at the very beginning. None of the following

#include <caffe.hpp> 

#include <caffe/caffe.hpp> 

#include <home/username/caffe/caffe.hpp>

works because the path to the caffe is not known the way it is given by PYTHONPATH in the pycaffe code. How then do I add the caffe module in the C++ code?

Upvotes: 1

Views: 196

Answers (2)

cerebrou
cerebrou

Reputation: 5540

The counterpart of the PYTHONPATH is CPLUS_INCLUDE_PATH, which can be used in the following way:

export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/home/username/caffe/include/

and then

#include "caffe/caffe.hpp"

There may be some other path headers missing, in such a case adding the paths to those headers to the CPLUS_INCLUDE_PATH will solve the issue.

Upvotes: 0

Maxim Egorushkin
Maxim Egorushkin

Reputation: 136355

The path to directories with additional headers must be specified to the compiler. Often, using -I<include-path> command line switch, e.g. -I/home/username/caffe.

Your build system may offer a few different ways of adding additional include directories.

Upvotes: 3

Related Questions