I was able to get tutorial #1 to compile fine. But I can’t get the 2nd one to compile.
When you do new -> Project, maybe one of those settings are interfering? Pretty sure I did empty project, else console.
What’s wrong?
compile error:
Error 1 error LNK2019: unresolved external symbol _WinMain@16 referenced in function
___tmainCRTStartup C:\...\02-videomode-iterate\MSVCRTD.lib(crtexew.obj) 02-videomode-iterate
Error 2 error LNK1120: 1 unresolved externals C:\...\Debug\02-videomode-iterate.exe 02-videomode-iterate
entire source:
#include <SFML/Window.hpp>
int main()
{
sf::Window App(sf::VideoMode(800, 600, 32), "SFML-tut: 02");
bool Running = true;
while (Running)
{
App.Display();
}
return EXIT_SUCCESS;
}
Project settings:
include dir, lib: dir set correctly.
c++ -> preprocessor -> preprocessor definitions:
SFML_DYNAMIC
linker -> input
tried:
sfml-window.libandsfml-window-d.lib( visual studio seems to always use debug mode at start? but tutorial #1 only worked when I didn’t use -d version.
subsystem:
/SUBSYSTEM:WINDOWS
When you set the
/SUBSYSTEM:WINDOWSflag, the linker will look for aWinMainfunction rather than the conventionalmain. You have two options:/SUBSYSTEM:CONSOLE. You will get an annoying (or perhaps helpful) console window, which you can get rid of withFreeConsole.Change
maintoWinMainwith the following signature:Unless you need to access
argcandargv, this change shouldn’t cause too much trouble.Edit: Perhaps this is worth a look too (copied from the second tutorial):
So, I suppose that boils down to adding
sfml-main.lib(or similar) to the list of libraries to link with.