Hi ! 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-d.lib sfml-graphics-s-d.lib sfml-window-s-d.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();
std::string test;
std::cin >> test;
return 42;
}
And now here is the errors I get :
EDIT1>------ start of the global generation : Projet : AudioTest, Configuration : Debug Win32 ------
1> Compilateur d'optimisation Microsoft (R) 32 bits C/C++ version 16.00.30319.01 for 80x86
1> Copyright (C) Microsoft Corporation. Tous droits réservés.
1>
1> cl /c /I"C:\Users\theo-richard\Documents\Visual Studio 2010\SFML-2.0\include" /ZI /nologo- /W3 /WX- /Od /Oy- /D SFML_STATIC /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yc"StdAfx.h" /Fp"Debug\AudioTest.pch" /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt stdafx.cpp
1>cl :command line warning D9035: l'option 'nologo-' est déconseillée et sera supprimée dans une version ultérieure
1>
1> stdafx.cpp
1> Compilateur d'optimisation Microsoft (R) 32 bits C/C++ version 16.00.30319.01 pour 80x86
1> Copyright (C) Microsoft Corporation. Tous droits réservés.
1>
1> cl /c /I"C:\Users\theo-richard\Documents\Visual Studio 2010\SFML-2.0\include" /ZI /nologo- /W3 /WX- /Od /Oy- /D SFML_STATIC /D SFML_STATIC /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yu"StdAfx.h" /Fp"Debug\AudioTest.pch" /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt AudioTest.cpp
1>cl : Ligne de commande warning D9035: l'option 'nologo-' est déconseillée et sera supprimée dans une version ultérieure
1>
1> AudioTest.cpp
1> Microsoft (R) Incremental Linker Version 10.00.30319.01
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> "/OUT:C:\Users\theo-richard\Documents\Visual Studio 2010\Projects\AudioTest\Debug\AudioTest.exe" /INCREMENTAL:NO "/LIBPATH:C:\Users\theo-richard\Documents\Visual Studio 2010\SFML-2.0\lib" "sfml-audio-s-d.lib" "sfml-graphics-s-d.lib" "sfml-window-s-d.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 /MANIFEST "/ManifestFile:Debug\AudioTest.exe.intermediate.manifest" "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /DEBUG "/PDB:C:\Users\theo-richard\Documents\Visual Studio 2010\Projects\AudioTest\Debug\AudioTest.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:C:\Users\theo-richard\Documents\Visual Studio 2010\Projects\AudioTest\Debug\AudioTest.lib" /MACHINE:X86 Debug\AudioTest.obj
1> Debug\stdafx.obj
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.