SFML 2.3和CodeBlocks错误编译

时间:2015-06-12 23:54:35

标签: c++ compilation codeblocks sfml

我正在尝试让sfml与codeblocks一起使用。我在本视频教程中做了所有内容:https://www.youtube.com/watch?v=gEGWO8ug2bY

如果我只添加SFML / Graphics.hpp,那么一切都有效,所以我的配置并不完全糟糕 但是,如果我尝试添加SFML / Audio.hpp(我需要在我的项目中添加声音)并编写“sf :: Music background_music;”我收到错误:

    ||=== Build: Debug in JeudeGo (compiler: GNU GCC Compiler) ===|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundStream.cpp|52|undefined reference to `sf::Thread::~Thread()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundStream.cpp|70|undefined reference to `sf::Thread::wait()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundStream.cpp|59|undefined reference to `sf::Thread::~Thread()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundStream.cpp|59|undefined reference to `sf::Thread::~Thread()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundStream.cpp|135|undefined reference to `sf::Thread::launch()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundStream.cpp|166|undefined reference to `sf::Thread::wait()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundStream.cpp|228|undefined reference to `sf::Thread::launch()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(InputSoundFile.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\InputSoundFile.cpp|74|undefined reference to `sf::FileInputStream::FileInputStream()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(InputSoundFile.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\InputSoundFile.cpp|79|undefined reference to `sf::FileInputStream::open(std::string const&)'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(InputSoundFile.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\InputSoundFile.cpp|117|undefined reference to `sf::MemoryInputStream::MemoryInputStream()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(InputSoundFile.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\InputSoundFile.cpp|122|undefined reference to `sf::MemoryInputStream::open(void const*, unsigned int)'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundFileFactory.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundFileFactory.cpp|71|undefined reference to `sf::FileInputStream::FileInputStream()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundFileFactory.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundFileFactory.cpp|72|undefined reference to `sf::FileInputStream::open(std::string const&)'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundFileFactory.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundFileFactory.cpp|78|undefined reference to `sf::FileInputStream::seek(long long)'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundFileFactory.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundFileFactory.cpp|84|undefined reference to `sf::FileInputStream::~FileInputStream()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundFileFactory.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundFileFactory.cpp|84|undefined reference to `sf::FileInputStream::~FileInputStream()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundFileFactory.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundFileFactory.cpp|95|undefined reference to `sf::MemoryInputStream::MemoryInputStream()'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundFileFactory.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundFileFactory.cpp|96|undefined reference to `sf::MemoryInputStream::open(void const*, unsigned int)'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundFileFactory.cpp.obj):D:\sfml-release\_Sources\SFML\src\SFML\Audio\SoundFileFactory.cpp|101|undefined reference to `sf::MemoryInputStream::seek(long long)'|
D:\Info\SFML-2.3\lib\libsfml-audio-s-d.a(SoundFileFactory.cpp.obj):D:\sfml-release\_Sources\SFML\include\SFML\System\MemoryInputStream.hpp|43|undefined reference to `vtable for sf::MemoryInputStream'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_write'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| more undefined references to `oggpack_write' follow|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_readinit'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_readinit'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| more undefined references to `oggpack_read' follow|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_read'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| more undefined references to `oggpack_read' follow|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_writeinit'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_bytes'|
D:\Info\SFML-2.3\lib\libvorbis.a(info.o):info.c|| undefined reference to `oggpack_writeclear'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|

我的链接库(按此顺序):

sfml-graphics-s-d 
sfml-window-s-d 
sfml-system-s-d 
sfml-audio-s-d 
sfml-network-s-d 
flac 
ogg 
vorbis 
vorbisenc 
vorbisfile 
openal32
jpeg
freetype
ws2_32
gdi32
opengl32
winmm 

和#defines:

SFML_STATIC
UNICODE

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

尝试重新排序您的链接。 Sfml系统应该在链接器设置中持续或首先使用。它应该是最后一个SFML链接。