在Codelite中链接SFML,找不到库

时间:2016-03-11 00:18:14

标签: c++ mingw sfml static-linking codelite

我试图在Codelite 9.1.3中链接SFML2.3.1。我使用的是Windows 10,64位。我根据本教程http://en.sfml-dev.org/forums/index.php?topic=18820.0做了一切。我做了Include Paths,Library Paths,以正确的顺序进入包括依赖关系的库。很多其他人也提出了类似的问题,我已经尝试了那里提供的所有解决方案 - Linking SFML in CodeLite - 以及其他几个。这是我得到的错误:

C:\WINDOWS\system32\cmd.exe /C C:/TDM-GCC-64/bin/mingw32-make.exe -j8 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ CodeLiteProject - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Users/Benjamin/Documents/sfml/CodeLiteProject'
C:/TDM-GCC-64/bin/g++.exe -o ./Debug/CodeLiteProject @"CodeLiteProject.txt" -L. -LC:/SFML-2.3.1/lib  -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lsfml-audio-s -lsfml-network-s -lopengl32 -lfreetype -ljpeg -lwinmm -lgdi32 -lopenal32 -lws2_32
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/SFML-2.3.1/lib/libsfml-graphics-s.a when searching for -lsfml-graphics-s
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/SFML-2.3.1/lib\libsfml-graphics-s.a when searching for -lsfml-graphics-s
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/SFML-2.3.1/lib/libsfml-graphics-s.a when searching for -lsfml-graphics-s
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lsfml-graphics-s

并且它为每个库重复那些相同的最后四行(跳过不兼容 - 找不到)。然后,它说了这个:

collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/CodeLiteProject] Error 1
CodeLiteProject.mk:78: recipe for target 'Debug/CodeLiteProject' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/Benjamin/Documents/sfml/CodeLiteProject'
mingw32-make.exe: *** [All] Error 2

所有我曾经真正使用过编译器之前点击了#34; Build and Run"所以我非常感谢任何帮助。此外,我尝试了进入库的各种不同方式(-l *,* -s,* -s-d,* .lib,* .a等)

2 个答案:

答案 0 :(得分:0)

您似乎没有链接调试SFML库,但项目正在调试模式下构建。追加" -d"在Debug中构建时到SFML lib名称的末尾,例如:

/TDM-GCC-64/bin/g++.exe -o ./Debug/CodeLiteProject @"CodeLiteProject.txt" -L. -LC:/SFML-2.3.1/lib  -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d -lsfml-audio-s-d -lsfml-network-s-d ... 

答案 1 :(得分:0)

这一行:

  

C:/ TDM-GCC-64 / bin中/../ LIB / GCC / x86_64的-W64-的mingw32 / 5.1.0 /../../../../ x86_64的-W64-的mingw32 / bin中/ld.exe:在搜索-lsfml-graphics-s时跳过不兼容的C:/SFML-2.3.1/lib/libsfml-graphics-sa

此错误通常意味着您有一个arch差异,即您的代码编译为64位应用程序,而SFML库构建为32位库。

尝试使用使用64位编译器构建的SFML库(最好使用与您使用的编译器相同的编译器 - TDM-GCC 64位/ v5.1)