2010-10-03 33 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