1
General / Properly linking 32-bit debug SFML-provided WinMain?
« on: December 10, 2024, 05:09:36 pm »
I am following the SFML and Visual Studio tutorial (https://www.sfml-dev.org/tutorials/2.6/start-vc.php) using the 32-bit download of SFML-2.6.2. I want to get rid of the console window, so I changed the Project Settings -> Linker -> System -> SubSystem from "Console (/SUBSYSTEM:CONSOLE" to "Windows (/SUBSYSTEM:WINDOWS)" [1]. This just requires that I provide a WinMain. I am trying to link in one of the sfml-main files, which works fine for the release version (sfml-main.lib), but bad things happen trying to use sfml-main-d.lib.
I get this warning after adding sfml-main-d.lib to the list of additional files to link and compiling:
sfml-main-d.lib(MainWin32.obj) : warning LNK4099: PDB '' was not found with 'sfml-main-d.lib(MainWin32.obj)' or at ''; linking object as if no debug info
I note that SFML\lib\ contains sfml-main.lib and sfml-main-d.lib, but SFML\lib\Debug\ contains sfml-main-d.pdb and sfml-main-s.pdb (SFML\lib\Release\ is empty.)
Since this is a warning, not an error, the .exe is created and when I try to run it, my Malwarebytes Anti-Malware quarantines my .exe due to having the threat MachineLearning/Anomalous.95%.
What am I doing wrong for the debug version?
[1] The expected error after changing the subsystem but not providing a WinMain:
MSVCRTD.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
*Note: I've copied the .DLLs into the .exe Release/Debug directories by hand.
I get this warning after adding sfml-main-d.lib to the list of additional files to link and compiling:
sfml-main-d.lib(MainWin32.obj) : warning LNK4099: PDB '' was not found with 'sfml-main-d.lib(MainWin32.obj)' or at ''; linking object as if no debug info
I note that SFML\lib\ contains sfml-main.lib and sfml-main-d.lib, but SFML\lib\Debug\ contains sfml-main-d.pdb and sfml-main-s.pdb (SFML\lib\Release\ is empty.)
Since this is a warning, not an error, the .exe is created and when I try to run it, my Malwarebytes Anti-Malware quarantines my .exe due to having the threat MachineLearning/Anomalous.95%.
What am I doing wrong for the debug version?
[1] The expected error after changing the subsystem but not providing a WinMain:
MSVCRTD.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
*Note: I've copied the .DLLs into the .exe Release/Debug directories by hand.