【问题标题】:Linking SFML-2.2 On 64bit Win7 Using g++使用 g++ 在 64 位 Win7 上链接 SFML-2.2
【发布时间】: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


    【解决方案1】:

    我的问题的解决方案是:

    g++ 想要 64 位 库,而我却给了它 32 位 库,尽管网站有建议。
    解决方案是下载并构建 64 位库。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-09
      • 1970-01-01
      • 1970-01-01
      • 2012-08-28
      • 1970-01-01
      • 2012-07-20
      • 2011-04-12
      • 2013-10-04
      相关资源
      最近更新 更多