Trying to compile an Fast Light Tool Kit project for the first time. This is one I've generated in FLUID and dragged into Code::Blocks IDE (MinGW compiler).

Not sure what this error means or how to fix it but it seems that it's very common?

Any clues as to what it means. Thanks
The error is below.

Build started on: 16-06-2013 at 00:32.23
Build ended on: 16-06-2013 at 00:32.23
-------------- Build: Release in testfluid (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -LC:\fltk-1.3.2\lib -LC:\WINDOWS\system32\gdi32.dll -o bin\Release\testfluid.exe obj\Release\main.o -lfltk -lole32 -luuid -lcomctl32 -lwsock32 -lm -lgdi32 -luser32 -lkernel32 -lmingw32 C:\fltk-1.3.2\lib\libfltk.a C:\fltk-1.3.2\lib\libfltk_forms.a C:\fltk-1.3.2\lib\libfltk_gl.a C:\fltk-1.3.2\lib\libfltk_images.a C:\fltk-1.3.2\lib\libfltk_jpeg.a C:\fltk-1.3.2\lib\libfltk_png.a C:\fltk-1.3.2\lib\libfltk_z.a C:\WINDOWS\system32\gdi32.dll -mwindows
c:/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../libmingw32.a(main.o):main.c:(.text.startup+0xa7): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings (0 minutes, 0 seconds)

Recommended Answers

All 6 Replies

Sounds like you created a windows console program but attempting to compile a Windows win32 api GUI program. win32 api programs have WinMain() instead of main() as in console programs.

Err, my mistake.
I thought I had seen this error before.
I forgot to add the sourcefile with the main function in it.

Well, if the moderators want to delete this entire thread then feel free.

Hope I didn't ruin anyones day.

No, you didn't ruin my day :) Just mark the thread Solved and everything will be ok.

WinMain@16 usually apears when you try to compile some files, which doesn't contain the main()/WinMain() function (starting point of the program). In your case, not including the souce file with the main() function in it was causing your troubles.

I'm tryibg to use opencv in eclipse c++ and I get the same error but I have

main()

function.

I have the following result

**** Internal Builder is used for build               ****
g++ -IC:\opencv\build\include -O0 -g3 -Wall -c -fmessage-length=0 -osrc\main.o ..\src\main.cpp
g++ -LC:\opencv\build\x86\vc10\lib -LC:\opencv\build\x86\vc11\lib -otest.exe src\main.o -lopencv_core247 -lopencv_core247d -lopencv_highgui247 -lopencv_highgui247d -lopencv_imgproc247 -lopencv_imgproc247d
C:/MinGW/i686-pc-mingw32/lib/libmingw32.a(lib32_libmingw32_a-crt0_c.o):crt0_c.c:(.text+0x3c): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
Build error occurred, build is stopped

undefined reference to `WinMain@16'

That normally means you are compiling a MS-Windows GUI program but use main() instead of WinMain(). But I think you need to post code and the makefile so it can be tested. Does the esample program here compile correctly?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.