开发者

My first encounter with Boost... Include errors

I am trying to run a boost example but I am getting the following error:

g++ bimap.cpp -o bimap
bimap.cpp:1:28: error: boost/config.hpp: No such file or directory
bimap.cpp:8:27: error: boost/bimap.hpp: No such file or directory
bimap.cpp: In function 'int main()':
bimap.cpp:27: error: 'boost' has not been declared
bimap.cpp:27: error: expected initializer before '<' token
bimap.cpp:28: error: 'results_bimap' has not been declared
bimap.cpp:28: error: expected initializer before 'position'
bimap.cpp:30: error: 'results_bimap' was not declared in this scope
bimap.cpp:30: error: expected `;' before 'results'
bimap.cpp:31: e开发者_C百科rror: 'results' was not declared in this scope
bimap.cpp:31: error: 'position' was not declared in this scope

But my environment variables are set as follows:

BOOST_HOME /apps/rhel5/boost_1_39_0 
BOOST_INCLUDE -I/apps/rhel5/boost_1_39_0/include/boost-1_39/ 
LINK_BOOST -L/apps/rhel5/boost_1_39_0/lib -Xlinker -rpath -Xlinker /apps/rhel5/boost_1_39_0/lib 

Am I supposed to provide any extra options while compiling?


You must provide the paths to boost files to g++ itself.

Try this:

g++ bimap.cpp -I/apps/rhel5/boost_1_39_0/include/boost-1_39/ -L/apps/rhel5/boost_1_39_0/lib -Xlinker -rpath -Xlinker /apps/rhel5/boost_1_39_0/lib -o bimap

Or (solution by TokenMacGuy):

g++ bimap.cc $BOOST_INCLUDE $LINK_BOOST
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜