I am porting a number of mature Win32 apps developed using VS 2015 under Windows 7 Professional to be built using VS 2019 under Windows 10 . Some edits to the original source and heading files are necessary to accommodate VS 2019 idiosyncrasies. I have accomplished this arduous task for 4 such applications thus far, but for the 5th such app I receive the following bizarre error message:
Build started...
1>------ Build started: Project: FiveAcross, Configuration: Debug Win32 ------
1>MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
1>C:\Users\rwhoe\OneDrive\Documents\Rob\AppsForWin_vs2019\FiveAcross\Debug\FiveAcross.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "FiveAcross.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The 5 applications are all similar in structure and share a lot of source code in common. However, I have never before seen the error message indicated above. Please explain how to remedy this issue.
I found an existing thread describing this error message under
https://social.msdn.microsoft.com/Forums/en-US/caa8d802-bb59-4e41-a2ae-3ca8911862c3/unresolved-external-quotint-cdecl-invokemainvoidquot-after-vs2017-1561-update?forum=visualstudiogeneral
but that thread is archived, and my attempts to apply the suggested remedies have been futile.
Additional info: The "main" function in all 5 of my apps is
int APIENTRY _tWinMain(
HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPTSTR lpCmdLine
, int nCmdShow
I subsequently noticed the property setting under
Configuration Properties => Linker => System => SubSystem
was set to "Console .. " something or other.
I overwrote this setting with "Windows (/SUBSYSTEM:WINDOWS)", and that cleared the problem.