Im having great troubles compiling a simple test project using with SFML. I have seen many errors similar to the ones Im getting on the internet but everything i tried failed.
I am static linking sfml.
In the project's properties, I added the path to the SFML headers and the SFML libraries.
I have define the SFML_STATIC macro in the preprocessor options of my project.
I added modules and their dependencies like so :
sfml-audio-s.lib sfml-audio-s-d.lib sfml-graphics-s.lib sfml-graphics-s-d.lib sfml-window-s.lib sfml-window-s-d.lib sfml-system-s.lib sfml-system-s-d.lib opengl32.lib freetype.lib jpeg.lib winmm.lib flac.lib vorbis.lib vorbisenc.lib vorbisfile.lib ogg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
I even added the dll files in my executable folder even though its not necessary when static building.
here is my code :
#include "stdafx.h" #include <SFML/Audio.hpp> #include <iostream> #include <stdlib.h> int _tmain(int argc, _TCHAR* argv[]) { std::cout << "helloo" << std::endl; sf::SoundBuffer buffer; if (!buffer.loadFromFile("A4.wav")) std::cout << "cant open file" << std::endl; sf::Sound sound; sound.setBuffer(buffer); sound.play(); _sleep(5000); return 42; }
And now here is the errors I get :
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::SoundBuffer::~SoundBuffer(void)" (??1SoundBuffer@sf@@QAE@XZ) referenced in function _wmain
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall sf::Sound::~Sound(void)" (??1Sound@sf@@UAE@XZ) referenced in function _wmain
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Sound::play(void)" (?play@Sound@sf@@QAEXXZ) referenced in function _wmain
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Sound::setBuffer(class sf::SoundBuffer const &)" (?setBuffer@Sound@sf@@QAEXABVSoundBuffer@2@@Z) referenced in function _wmain
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Sound::Sound(void)" (??0Sound@sf@@QAE@XZ) referenced in function _wmain
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::SoundBuffer::loadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?loadFromFile@SoundBuffer@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _wmain
1>AudioTest.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::SoundBuffer::SoundBuffer(void)" (??0SoundBuffer@sf@@QAE@XZ) referenced in function _wmain
additionnal infos :
Im using visual studio 2010 express.
I downloaded "SFML 2.3 Visual C++ 10 (2010) - 64-bit".
any help appreciated.
EDIT : as I said I tried many things, I have read a LOT of stack overflow or other forums posts, nothing worked... I have been stuck on this for 2 weeks now. I'd really appreciate some help