簡體   English   中英

在CodeLite中鏈接SFML

[英]Linking SFML in CodeLite

好的,所以我試圖在CodeLite項目中鏈接SFML,但是沒有成功。 所以我做了什么:

  1. 將SFML的include文件夾添加到CodeLite的IncludePaths中。
  2. 將SFML的lib文件夾添加到CodeLite的LibrariesSearchPath中。
  3. 在CodeLite中的預處理器中添加了SFML_STATIC。

  4. 將庫添加到LinkerOptions中,如下所示:

     sfml-graphics;sfml-window;sfml-audio;sfml-network;sfml-system 
  5. 在調試文件夾和項目文件夾中添加了5個dll(sfml-graphics-2.dll等)

這是生成日志: C:\\WINDOWS\\system32\\cmd.exe /C ""E:/Program Files (x86)/CodeBlocks/MinGW /bin/mingw32-make.exe" -j4 SHELL=cmd.exe -e -f Makefile"" "----------Building project:[ Test - Debug ]----------" mingw32-make.exe[1]: Entering directory 'F:/Dropbox/Programming/OpenGL/Test' "E:/Program Files (x86)/CodeBlocks/MinGW/bin/g++.exe" -o ./Debug/Test @"Test.txt" -L. -LF:/Dropbox/Programming/SFML/SFML-2.3.2x86/lib sfml-graphics sfml-window sfml-audio sfml-network sfml-system g++.exe: error: sfml-graphics: No such file or directory g++.exe: error: sfml-window: No such file or directory g++.exe: error: sfml-audio: No such file or directory g++.exe: error: sfml-network: No such file or directory g++.exe: error: sfml-system: No such file or directory mingw32-make.exe[1]: *** [Debug/Test] Error 1 Test.mk:78: recipe for target 'Debug/Test' failed mingw32-make.exe[1]: Leaving directory 'F:/Dropbox/Programming/OpenGL/Test' mingw32-make.exe: *** [All] Error 2 Makefile:4: recipe for target 'All' failed ====1 errors, 0 warnings==== C:\\WINDOWS\\system32\\cmd.exe /C ""E:/Program Files (x86)/CodeBlocks/MinGW /bin/mingw32-make.exe" -j4 SHELL=cmd.exe -e -f Makefile"" "----------Building project:[ Test - Debug ]----------" mingw32-make.exe[1]: Entering directory 'F:/Dropbox/Programming/OpenGL/Test' "E:/Program Files (x86)/CodeBlocks/MinGW/bin/g++.exe" -o ./Debug/Test @"Test.txt" -L. -LF:/Dropbox/Programming/SFML/SFML-2.3.2x86/lib sfml-graphics sfml-window sfml-audio sfml-network sfml-system g++.exe: error: sfml-graphics: No such file or directory g++.exe: error: sfml-window: No such file or directory g++.exe: error: sfml-audio: No such file or directory g++.exe: error: sfml-network: No such file or directory g++.exe: error: sfml-system: No such file or directory mingw32-make.exe[1]: *** [Debug/Test] Error 1 Test.mk:78: recipe for target 'Debug/Test' failed mingw32-make.exe[1]: Leaving directory 'F:/Dropbox/Programming/OpenGL/Test' mingw32-make.exe: *** [All] Error 2 Makefile:4: recipe for target 'All' failed ====1 errors, 0 warnings====

我正在使用CodeLite 9.0.9和SFML-2.3.2x86。

1 “從SFML 2.2開始,當進行靜態鏈接時,您還必須將所有SFML的依賴項也鏈接到您的項目。這意味着,例如,如果要鏈接sfml-window-s或sfml-window-sd,您還將擁有鏈接opengl32,winmm和gdi32。其中一些依賴庫可能已經在“繼承的值”下列出,但是自己重新添加它們不會引起任何問題。 如果要靜態鏈接,則鏈接的庫應帶有-s后綴,而鏈接其他庫時請查看

2。 “鏈接到多個SFML庫時,請確保以正確的順序鏈接它們,這對於GCC非常重要。規則是,必須將依賴於其他庫的庫放在列表的第一位。每個SFML庫都取決於在sfml-system上,sfml-graphics也取決於sfml-window。因此,這三個庫的正確順序是:sfml-graphics,sfml-window,sfml-system,如上面的屏幕截圖所示。” 將鏈接順序設置為graphics-s / window-s / system-s / etc

3。 “重要的是要鏈接到與配置相匹配的庫:“ sfml-xxx-d”用於Debug,“ sfml-xxx”用於Release。混合不好會導致崩潰。” 從構建日志中,我可以看到您正在使用帶有發布庫(不帶-d后綴的庫)將項目構建為Debug,然后必須將鏈接的庫更改為sfml-graphics-sd / etc

如果上述建議無效,則您將搜索路徑設置為錯誤。 祝好運

好的,我終於設法通過更改如下庫來修復它: -lsfml-graphics-s;-lsfml-window-s;-lsfml-audio-s;-lsfml-network-s;-lsfml-system-s;-lopengl32;-lfreetype;-ljpeg;-lwinmm;-lgdi32;-lopenal32;-lws2_32

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM