1

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.

7
  • module machine type 'x64' conflicts with target machine type 'X86' Means your are mixing 32 and 64 bit. Your application has to be the same all the binaries you link to.
    – drescherjm
    Commented Feb 3, 2019 at 12:47
  • Yeah, i kind of fixed this (because I don't get it now), but instead of this ONLY ONE "module machine type" error I get other "mismatch detected" errors...
    – AtticFizz
    Commented Feb 3, 2019 at 12:58
  • i did this: imgur.com/a/7PAV6E2
    – AtticFizz
    Commented Feb 3, 2019 at 22:10
  • I do see that now. I have never touched that setting. What target are you building x86 or x64? x86 is 32 bit x64 is 64 bit.
    – drescherjm
    Commented Feb 3, 2019 at 22:53
  • I build in x64, although my game started with x86, I chaned it when I updated mu sfml 2.4.2 to sfml 2.5.1. And I changed because my computer is 64 bit, but the build doesn't have to match 64bit system, of does it? Btw the game was error'ing that "color" line from the beginning of the game, when it was built in x86. Btw btw just now i noticed that in these 200 errors i not only get "mismatch detected errors but also "unresolved external symbol _imp_cosf" etc. I'll update the question :)
    – AtticFizz
    Commented Feb 4, 2019 at 13:54

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.