The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
MinGW-w64, multiple definition of `main'
KyleN


Joined: 19 Oct 2014
Posts: 1
I've uploaded my CMakeLists.txt, FindSDL2.cmake, code and build log here: https://gist.github.com/anonymous/f2fb82822908f11bf338

I'm trying to compile a simple program with MinGW, but I'm getting errors. I don't know if I'm linking SDL2 incorrectly, or if it's something else.
I'm using this version of MinGW-w64: x86_64-4.9.1-posix-seh-rt_v3-rev1.7
What's peculiar, however, is the error message that CLion spits back at me:

Quote:
Linking CXX executable OpenGL.exe
D:\Programming\Projects\CLion\OpenGL\Libraries\SDL2-2.0.3\lib\x64\SDL2main.lib(./x64/Release/SDL_windows_main.obj)Sad.text[main]+0x0): multiple definition of `main'
D:/Software/Programs/MinGW/w64/x86_64-4.9.1-posix-seh-rt_v3-rev1.7/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.cSad.text.startup+0x0): first defined here
Warning: corrupt .drectve at end of def file
collect2.exe: error: ld returned 1 exit status


It says there are multiple definitions of main, even though there's only 1 in my code. I know SDL2 provides a main function, which is probably why the compiler quits on me.

Can anyone help me out with this?