【发布时间】:2015-02-17 15:18:34
【问题描述】:
我使用下面的命令编译了我的程序,运行时没有错误。
g++ -c main.cpp -I C:\SFML-2.2\include -std=c++11
然后,我尝试使用命令链接它:
g++ main.o -o sfml-app -L C:\SFML-2.2\lib -lsfml-graphics -lsfml-window -lsfml-system
这些是从上述命令返回的错误:
d:/mingw/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mi
ngw32/bin/ld.exe: skipping incompatible D:\SFML-2.2\lib/libsfml-graphics.a when
searching for -lsfml-graphics
d:/mingw/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mi
ngw32/bin/ld.exe: skipping incompatible D:\SFML-2.2\lib\libsfml-graphics.a when
searching for -lsfml-graphics
d:/mingw/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mi
ngw32/bin/ld.exe: skipping incompatible D:\SFML-2.2\lib/libsfml-graphics.a when
searching for -lsfml-graphics
d:/mingw/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mi
ngw32/bin/ld.exe: cannot find -lsfml-graphics
错误继续完全相同,但“在搜索 -lsfml-graphics 时跳过不兼容的 C:\SFML-2.2\lib\sfml-graphics.lib”,与 -lsfml-system 相同。
项目文件夹位于:C:\Users\Andy\Desktop\SFMLTEST,SFML 文件夹位于:D:\SFML-2.2
我现在已经按照他们网站上的建议下载了适用于 32 位 Windows 的 SFML-2.2 和 GCC 4.9.2 MinGW (DW2) - 32 位,并且我有 g++ 版本:(GCC) 4.9.1
在 Windows 上,选择 32 位或 64 位库应基于 您要编译的平台,而不是您拥有的操作系统。确实,你 可以在64位Windows上完美编译运行32位程序。
现在我的问题是,上述错误是什么意思?我该如何解决?
编辑: 几个月前找到了解决方案,在这里添加答案,因为它可能对其他人有所帮助。
【问题讨论】:
标签: c++ g++ linker-errors sfml