Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Code::Blocks builder error: undefined reference to `WinMain'

How to fix the following error message when trying to compile C++ console application project on Code::Blocks?

undefined reference to `WinMain’

All other questions on Stack Overflow are about "WinMain@16", which is not the case here.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

WinMain is linked to in windows when you want to create a windows application.

https://learn.microsoft.com/en-us/windows/win32/learnwin32/winmain–the-application-entry-point

For the complier to look for the main function you will have to change at the linker stage that it is a console application and not a windowed one.

Or you might just need to restart CodeBlocks:
C++ undefined reference to WinMain@16 (Code::Blocks)

Or you might have just have deleted main() 😉

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading