0

recently I've installe SFML for Visual studio 2015. I have read the tutorial for this specific task on there web site but after the test (compiling and running debug) this error show up:

https://pastebin.com/mY7r7zy9

1>------ Build started: Project: projet game, Configuration: Debug Win32 ------
1>  main.cpp
1>MSVCRTD.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
1>C:\Users\Cewein\documents\visual studio 2015\Projects\projet game\Debug\projet game.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

why and what should i do ? should i rename my main.cpp to winmain.cpp ?

thanks you for the help

P.S: VS2015 is one the main drive where the OS is (C:) but SFML the folder is on another drive (E:)

Maximilien Nowak
  • 113
  • 1
  • 1
  • 8
  • 1
    Possible duplicate of [error LNK2019: unresolved external symbol \_WinMain@16 referenced in function \_\_\_tmainCRTStartup](https://stackoverflow.com/questions/6626397/error-lnk2019-unresolved-external-symbol-winmain16-referenced-in-function) – N00byEdge Aug 25 '17 at 23:32

1 Answers1

0

If your subsystem is set to Windows (/SUBSYSTEM:WINDOWS), you need to link sfml-main, which will define WinMain() and call main().

If your subsystem is set to Console (/SUBSYSTEM:CONSOLE), then you don't need to link sfml-main.

To change the subsystem, go to your project settings, then Properties -> Linker -> System -> SubSystem

Lukas
  • 2,461
  • 2
  • 19
  • 32