2010-10-03 56 views
0

我试图运行升压的例子,但我收到以下错误:我与升压第一次遇到......包含错误

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: error: 'results' was not declared in this scope 
bimap.cpp:31: error: 'position' was not declared in this scope 

但是我的环境变量设置如下:

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 

我应该在编译时提供任何额外的选项吗?

+1

升压现在是1.44版本。你应该更新。 – GManNickG 2010-10-03 04:19:47

+0

@GMan:我没有维护系统。它的一个集群:(也许我可以下载提升并编译它自己。 – Legend 2010-10-03 04:21:01

+0

fyi,编译boost很容易,下载,解压缩,'。/ boostrap','。/ bjam',完成 – Inverse 2010-10-03 05:03:59

回答

2

您必须提供将文件提升到g ++本身的路径。

试试这个:

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 

或(由TokenMacGuy溶液):

g++ bimap.cc $BOOST_INCLUDE $LINK_BOOST 
+0

太棒了!非常感谢...... :)完美地工作......有没有一种方法可以在该行中实际使用env变量? – Legend 2010-10-03 04:19:14

+2

OOOOOR,'g ++ bimap.cc $ BOOST_INCLUDE $ LINK_BOOST',因为它们已经在环境中... – SingleNegationElimination 2010-10-03 04:20:11

+0

@TokenMacGuy:有效!非常感谢... – Legend 2010-10-03 04:21:36