Reputation: 51
I'm having some issues with game programming for a while now. I wouldn't say I'm new to programming, but linking libraries is a new thing for me. And so this is my issue: when i started programming an sfml game (and I started using .h and .cpp files, using sfml 2.5.1 64-bit) I noticed that i can't use these and similar to these functions:
.setColor(Color::Black) / .setFillColor(Color::color)
I get an error saying:
public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (??0Color@sf@@QAE@EEEE@Z) already defined in sfml-graphics-d.lib(sfml-graphics-d-2.dll)
then I found that I must link static libraries for this to work, and I did so, but I got a new error saying:
module machine type 'x64' conflicts with target machine type 'X86'
I maybe fixed it by changing "target machine to "not set"" and then the next 237 errors comes up saying:
mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug'
public: __cdecl std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QEAA@H@Z) already defined in libcpmtd.lib(xlock.obj)
private: static class std::locale::_Locimp * __cdecl std::locale::_Init(bool)" (?_Init@locale@std@@CAPEAV_Locimp@12@_N@Z) already defined in libcpmtd.lib(locale0.obj)
unresolved external symbol __imp_cosf
unresolved external symbol __imp_sinf
and a lot more of these... basically, nearly every line is errored.
I found a possible solution to change Runtime Library to /MTd, but it doesn't seem to work, because i get the same 237 errors.
What could be the problem and how do i fix that?
Thank you in advance.
Upvotes: 1
Views: 523
Reputation: 927
As other people mentioned, you should be targeting x86, given that your binaries do so.
As for the multiple defines, make sure you are not compiling your .lib files, but only the SFML headers.
Don't include the DLL's anywhere, and make sure you're setting up the proper inputs to the linker.
SFML's website has a very thorough getting started guide if you follow it properly your linking will work.
I advise you start over, and follow the tutorial step by step. Also, make sure to read everything (skipping small parts of a tutorial is the source of all evil.)
Upvotes: 1