2015-06-06 143 views
0

我在Ubuntu 12.04中遇到了一些問題。在Ubuntu中,我應該在哪裏放置這些文件?

我有我想在我的code :: blocks項目中使用的SFML庫。

在SFML文件夾中有兩個子文件夾 - 包括lib。 include包含頭文件(.h文件)。 lib包含庫文件(.so文件)。

我無法直接將庫與我的項目鏈接,因爲編譯器找不到這些文件。

我在谷歌研究並發現,我必須將sfml文件放在標準路徑中,以正確地將它們連接到代碼塊中。 那麼,我應該把這些文件放在哪個默認標準位置?

編輯:在做了大量的搜索之後,我開始瞭解如何將標題和模塊放在正確的標準位置。但是在編譯和運行(無論是從代碼塊或終端)之後,這些未定義引用錯誤就來了 -

/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-graphics.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
/usr/local/lib/libsfml-window.so: undefined reference to `[email protected]_183' 
collect2: ld returned 1 exit status 

回答

0

你可以把的內容包括:文件夾中/usr/include目錄在/ usr /本地/包括LIB文件夾的內容/usr/lib目錄在/ usr/local/lib目錄

您也可以指定INC當你編譯你的代碼時,lude和庫路徑。例如,如果你正在使用gcc你可以這樣做:

gcc prog.c -oprog -I/path/to/include/folder -L/path/to/libraries/folder -lLibraryName.so

+0

**/usr/include目錄** **在/ usr /本地/包括**都在那裏。我可以把它們放在其中任何一個嗎? – arandomguy

+0

@Raj是的,它取決於編譯器,他們中的大多數都會在這兩個位置查找。 – Titus

+0

okey因此我將include包括到/ usr/include和lib到/ usr/lib中,但是codeblocks仍然給出了很多**未定義的引用**錯誤。我需要在代碼塊中做些什麼嗎? – arandomguy

相關問題