我最近安装MinGW和CSFML我的笔记本电脑,我跑:未定义参考_imp_sfBlendAlpha
gcc shaders.c -csfml-system -csfml-graphics
我得到一个错误:
...\ccV1NsAK.o:shaders.c:(.text+0x247):' undefined reference to _imp__sfBlendAlpha'
我该如何解决这个问题?
亲切的问候, 波士顿布鲁克斯。
更新1
我已经安装到不同的搜索路径玩耍了,但我不能得到这个工作。我重新安装了MinGW并将CSFML包中的文件粘贴到默认路径。现在,我得到:
gcc shaders.c -lcsfml-system -lcsfml-window -lcsfml-graphics
C:\Users\bbroo\AppData\Local\Temp\cc9QM4Nx.o:shaders.c:(.text+0x2d8): undefined reference to '_imp__sfBlendAlpha'
C:\Users\bbroo\AppData\Local\Temp\cc9QM4Nx.o:shaders.c:(.text+0x318): undefined reference to '_imp__sfTransform_Identity'
collect2.exe: error: ld returned 1 exit status
更新2
我复制CSFML我的主文件夹。我得到:
$ gcc -B ~/CSFML -Ld: ~/CSFML shaders.c -lcsfml-system -lcsfml-window -lcsfml-graphics
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find C:/MinGW/msys/1.0/home/bbroo/CSFML: Permission denied
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -lcsfml-system
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -lcsfml-window
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -lcsfml-graphics
collect2.exe: error: ld returned 1 exit status
头文件可以访问,但该点一个文件被“权限被拒绝” 如何设置权限为读 - 写 - 执行使用MSYS在CSFML在所有文件中的所有用户?
同样的问题,如果我使用C:\ SFML
更新3
当我将文件解压缩到默认路径,在文件夹中生成的子文件夹,我点一文件位于。它包含几个dot-a文件和一个自述文本文件。
本自述文件被复制到GCC-仅头文件 目录时会运行fixincludes通过的makefile GCC运行:
Many of the files in this directory were automatically edited from the standard system header files by the fixincludes process. They are system-specific, and will not work on any other kind of system. They are also not part of GCC. The reason we have to do this is because GCC requires ANSI C headers and many vendors supply ANSI-incompatible headers.
Because this is an automated process, sometimes headers get "fixed" that do not, strictly speaking, need a fix. As long as nothing is broken by the process, it is just an unfortunate collateral inconvenience. We would like to rectify it, if it is not "too inconvenient".
更新4
不链接编译工作得很好但单独链接不起作用:
[email protected] ~/Shaders
$ ld shaders.o libcsfml-system.a libcsfml-window.a libcsfml-graphics.a
shaders.o:shaders.c:(.text+0x10): undefined reference to `__main'
shaders.o:shaders.c:(.text+0x2d8): undefined reference to `_imp__sfBlendAlpha'
shaders.o:shaders.c:(.text+0x318): undefined reference to `_imp__sfTransform_Identity'
shaders.o:shaders.c:(.text+0x4bc): undefined reference to `sleep'
更新5
现在,我得到:
[email protected] ~/Shaders
$ ld shaders.o libcsfml-system.a libcsfml-window.a libcsfml-graphics.a csfml-system-2.dll csfml-window-2.dll csfml-graphics-2.dll
shaders.o:shaders.c:(.text+0x10): undefined reference to `__main'
shaders.o:shaders.c:(.text+0x4bc): undefined reference to `sleep'
这是仅针对sfBlendAlpha吗?你可以尝试自己定义它,如[BlendMode](https://github.com/SFML/CSFML/blob/master/src/SFML/Graphics/BlendMode.cpp)所示。如果这是您第一次在代码中使用CSFML,那么可能是编译器没有找到您的库,特别是在这种情况下sfBlendAlpha。你在使用非标准路径吗?请描述你如何安装CSFML。 – Chringo
我只是解压缩csfml包并将文件粘贴到默认路径。 –