2010-08-31 86 views
2

我今天從零開始安裝SFML,所以我可以在遊戲上工作。我下載了源代碼,運行了sudo make install,嘗試編譯我的一箇舊項目,但無法正確鏈接。所以我嘗試運行一個更簡單的項目:教程中的示例之一。我試圖編譯this one具體,但我得到這些錯誤:使用gcc鏈接到庫的問題

g++ -o atest test.cpp -lsfml-graphics -lsfml-window -lsfml-system /tmp/ccaa86fR.o: In function `main': 
test.cpp:(.text+0x1d2): undefined reference to `gluPerspective' 
collect2: ld returned 1 exit status 
make: *** [test] Error 1 

嘗試的even simpler project,一個在最初的教程中,我沒有碰到編譯問題。然而,當我嘗試運行它,我得到這個錯誤:

./atest: error while loading shared libraries: libsfml-graphics.so.1.6: cannot open shared object file: No such file or directory 

我檢查,並將文件並安裝到他們應該到哪裏去儘可能我的/ usr/local/lib目錄/這是知道。我在這裏做錯了什麼?

回答

2

-lGLU應該解決的第一個錯誤,併爲第二個確保/usr/local/lib/是在你的搜索LDCONFIG路徑(在Ubuntu下/etc/ld.so.conf/etc/ld.so.conf.d/*),並在運行了ldconfig命令:sudo ldconfig -v然後重試運行。

另請參閱man ldconfig