Home > Back-end >  Visual Studio keeps using wWinMain() as the entry point instead of the main() function I want it to
Visual Studio keeps using wWinMain() as the entry point instead of the main() function I want it to

Time:05-20

I started my Visual Studio project as a windows application, however I've come to realize that if I want to use GLFW then I'm supposed to open a GLFW window instead of a standard wWinMain window. I have a wWinMain function but since it kept running every time I ran the program instead of my int main() function with the GLFW window test code inside, I changed the name of the wWinMain function in the hopes that when building the program it would defer to the main() function I wrote. However it hasn't worked and instead I keep getting the same error:

error LNK2019: unresolved external symbol WinMain referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)

How do I get it to stop looking for the wWinMain function and just run the main() one instead?

The only solution that has worked so far is to rename my main() function to wWinMain and have it accept all the variables but do nothing with them and just run my code as normal inside, however this doesn't seem optimal.

I've also tried the answer suggested enter image description here

  • Subsystem = Console means main
  • Subsystem = windows means winmain
  • Related