User forums > Help
undefined reference to 'WinMain@16
chrisvj:
When attempting to run a file, I get the following:
--- Code: ---c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libmingw32.a(main.o):main.c|| undefined reference to `WinMain@16|
||=== Build finished: 1 errors, 0 warnings ===|
--- End code ---
this is the build log:
--- Code: ---
-------------- Build: Debug in delta3d ---------------
mingw32-g++.exe -L..\..\..\..\..\Delta3D\REL-2.5.0\inc -LC:\Delta3D\REL-2.5.0\inc -o bin\Debug\delta3d.exe obj\Debug\main.o -lgdi32 -luser32 -lkernel32
c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../libmingw32.a(main.o):main.c:(.text+0xd2): undefined reference to `WinMain@16
'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
--- End code ---
Will someone please tell me what I'm doing wrong? Ty in advance
EDIT: This happens even with a blank file
stahta01:
This a compiler question NOT a Code::Blocks Question. In the future ask compiler questions on a site that supports the Compiler.
Turning on Full Compiler Logging will help that site to help you.
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
IIRC, you are missing the -mwindows option.
http://mingw-starter.blogspot.com/2008/02/mingw-sdl.html
Tim S.
stahta01:
You NEED to learn the difference between an Compiler and the IDE!!!!!!!!!
DO NOT PM ME!!!!!!!
You need to learn to search this site and the internet!
http://forums.codeblocks.org/index.php/topic,7906.0.html
Tim S.
xunxun:
You should create a GUI project, but you created a console program.
colnelb:
I downloaded the latest version of Code::Blocks and installed the compiler that came with the download, MinGW. I am having the same problem. "undefined reference to 'WinMain@16'. I went to the MinGW blog site and found a reference to requiring to turn on the "mwindows flag". I have attempted and was unable to find a "compiler flag" "mwindows" anywhere in the compiler settings provided through the installed Code::Blocks IDE.
I did find a readme file in the MinGW folder installed under Code::Blocks that had the following comment: "This edition of TDM-GCC is an unofficial replacement for the official GCC binaries distributed by the MinGW project; please note the following caveats: * TDM-GCC is not formally affiliated with or endorsed by the MinGW project. * No level of support for TDM-GCC is in any way guaranteed, although a best effort is made to fix bugs as they are found or forward them to GCC Bugzilla."
At this point I am at a loss. Since Code::Blocks provided an "unofficial" version of MinGW with the installation of the IDE, then it is somewhat an issue of the Code::Blocks IDE, not just a "compiler problem".
How do I fix this problem? Do I download the MinGW installer from SourceForge and attempt to install it under the Code::Blocks install? How do I re-integrate the newer install of MinGW compiler with the existing installation of Code::Blocks?
Let me add this comment: I am something of an experienced programmer from many years ago, attempting to re-learn C++ for a specific project that I want to do. The level of difficulty I am in finding a solution to this issue would likely be more than anyone starting out would overcome.
Navigation
[0] Message Index
[#] Next page
Go to full version