Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » undefined reference to 'WinMain@16'(need help)
undefined reference to 'WinMain@16' [message #1817877] Mon, 02 December 2019 01:14 Go to next message
Eclipse UserFriend
I'm trying to compile the code on the Win32 tutorial page on Microsoft's website (I would link but forum rules are preventing me) using MinGW and the CDT internal builder, but I get the following error:

" c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../libmingw32.a(main.o):(.text.startup+0xb0): undefined reference to `WinMain@16' "

I've googled a ton and all I could find were references to unsaved projects, and I went ahead and turned save before build on in the preferences, but still no luck. Does anyone know where I could have gone wrong?

On a similar note, I've tried to use the Visual C++ toolchain instead but it seems it can't find windows.h or something, as that's the only #include in the code and it gives a ton of errors when that's the toolchain. Would anyone have an idea on that either?
Re: undefined reference to 'WinMain@16' [message #1817988 is a reply to message #1817877] Tue, 03 December 2019 18:21 Go to previous message
Eclipse UserFriend
The WIN32 tutorial is trying to build a Windows GUI application.
It's entry point would be "WinMain".
MinGW generally wants to build a console application with an entry point called "main".

To find windows.h (needed for a GUI application) depends on which version of VC++ you have.
You will also need the GUI DLL's.
The GCC compiler allows discovery of builtins such as include paths and macros.
VC++ does not.
Here's the answer for VS2015 :
https://social.msdn.microsoft.com/Forums/en-US/a470f517-b7f3-4b33-a793-ae107a3fff97/wheres-windowsh?forum=vcgeneral

You have to decide which type of application you want.
If you want to use VC++ you'll have to set the include paths manually.
Asking where the VC++ files are would be better asked at an MSDN site.

Previous Topic:Debug Target is null
Next Topic:hello world with eclipse c/c++
Goto Forum:
  


Current Time: Tue Jun 17 12:50:20 EDT 2025

Powered by FUDForum. Page generated in 0.25768 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top