使用g ++在64位Win7上链接SFML-2.2

时间:2014-12-18 18:30:07

标签: c++ g++ linker-errors sfml

我已经使用下面的命令编译了我的程序,该命令运行没有错误。

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位窗口的SFML-2.2和GCC 4.9.2 MinGW(DW2) - 32位,我有g ++版本:(GCC)4.9.1

  

在Windows上,选择32位或64位库应该基于哪些   您要编译的平台,而不是您拥有的操作系​​统。的确,你   可以在64位Windows上完美地编译和运行32位程序。

现在我的问题是,上述错误意味着什么?我该如何解决它们呢?

修改 几个月前找到解决方案,在这里添加答案,因为它可能会帮助其他人。

1 个答案:

答案 0 :(得分:0)

我的问题的解决方案是:

尽管网站提供了建议,但我还是给了 64位库,而g ++需要 64位库。
解决方案是下载并构建64位库。