SFML and VS2013 - WinMain/main linker error

222 views Asked by At

I am trying to use SFML with Visual Studio 2013 using the tutorial on the SFML website and using their sample code (replacing main() with WinMain()) but I'm getting the linker error:

Error 1 error LNK2019: unresolved external symbol _main referenced in function _WinMain@16

I am referencing the libs:

  • sfml-graphics-d.lib
  • sfml-window-d.lib
  • sfml-main-d.lib
  • sfml-system-d.lib

and I am pointing correctly to the 'include' and 'lib' folders in my Project Properties.

I have tried using 'main()' with sfml-main-d.lib referenced and 'WinMain()' without it referenced and I still get the linker error.

Any suggestions?

Thank you for your time

1

There are 1 answers

0
poncho On

Okay I seem to have solved it but don't know how. I'll do my best to explain to anyone else who is stuck:

I started a new project again with a fresh download of SFML 32-bit for VS2013.

I added sfml-main-d.lib and sfml-main.lib to my referenced libs (for debug and release respectively) and then use "int main()..." instead of "int __stdcall WinMain()" and it linked and compiled correctly.

I thought I had already tried this combination but I guess maybe not.

Thanks to anyone who took the time to read this question and to Elried for commenting.