SFML 2.3 and CodeBlocks error compilation

665 Views Asked by At

I'm trying to make sfml works with codeblocks. I did everything said in this video tutorial : https://www.youtube.com/watch?v=gEGWO8ug2bY

Everything works if I only add SFML/Graphics.hpp, so my config isn't completely bad.
But if I try to add SFML/Audio.hpp (I need to add sounds to my project) and write "sf::Music background_music;" i get the error :

    ||=== 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)) ===|

My linked libraries (in this order) :

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 

And #defines :

SFML_STATIC
UNICODE

Thanks for help!

1

There are 1 best solutions below

2
On BEST ANSWER

Try reordering your links. Sfml system should last or first in your linker settings. It should the last of the SFML links.