I've been getting the error undefined reference to WinMain@16
. To save space, here's a link to all the files currently in the project. At present, it shouldn't do much other than create a window, fill it in green and then draw a box in the corner, all the while tracking my mouse's position through the console. However, it won't build and I'm given the aforementioned error.
My linker libraries are:
- glew32s
- libSDL2main
- mingw32
- libSDL2
- opengl32
- glew32
I am using Codeblocks 13.12 with g++ following the C++11 ISO C++ language standard. My PC is using windows 10 in case that's relevant.
I've spent quite a while trying to find a solution and it seems everyone has an entirely different one, and so far none of them have worked for me. A few examples include:
- Adding SDL2_image to my link libraries in accordance with this similar question. It gave me the error
-lSDL2_image
. - Starting the project entirely from scratch in case some typo I failed to notice was the cause. (I got exactly the same error).
- Changing my
main
function toWinMain
. I got the same error message. - Adding a
Windows.h
header. This did nothing noticeable. - Various alleged "right orders" for my liker libraries. None of those have seemed to help thus far.
I should also point out that the answer provide by the user, Cheers and hth. - Alf, here might be what I'm looking for, but in all honesty I can't fully understand what I'm supposed to do in based on it.
If there's any relevant information that I forgot to include, please tell me and I'll do so as soon as possible. Thanks in advance.
#undef main
at the beginning of main.cpp – Tomkins