User forums > Help

linker errors

(1/1)

David Perfors:
When I want to build a project with wxwindows or SDL, I get the following error

--- Code: ---
C:/MinGW/lib/libwxmsw242.a(app.o)(.text+0x1a20):app.cpp: multiple definition of `WinMain@16'

--- End code ---

Is there something to do about it without making my own WinMain?

sushi_cw:
This is very old, but it's the closest thing I've found to my problem. I get the same thing when trying to build an SDL project. I installed Code::blocks bundled with mingw, added the SDL library paths for lib and include to the compiler options, and changed the #include <SDL/SDL.h> to #include <SDL.h>. That gets me through compiling, but linking fails with an error very like the one listed above:


--- Code: ---C:/Program Files/SDL-1.2.8/lib\SDLmain.lib(./Release/SDL_win32_main.obj):C:\public_cvs\SDL-:(.text[_main]+0x0): multiple definition of `main'
C:/Program Files/CodeBlocks/lib/libmingw32.a(main.o):main.c:(.text+0x0): first defined here
Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
C:/Program Files/SDL-1.2.8/lib\SDLmain.lib(./Release/SDL_win32_main.obj):C:\public_cvs\SDL-:(.text[_main]+0x55): undefined reference to `_alloca_probe'
C:/Program Files/SDL-1.2.8/lib\SDLmain.lib(./Release/SDL_win32_main.obj):C:\public_cvs\SDL-:(.text[_WinMain@16]+0x162): undefined reference to `_alloca_probe'
C:/Program Files/SDL-1.2.8/lib\SDLmain.lib(./Release/SDL_win32_main.obj):C:\public_cvs\SDL-:(.text[_WinMain@16]+0x1a5): undefined reference to `_alloca_probe'

--- End code ---

Any ideas? I've been trying to figure out how to get SDL to work with code::Blocks for hours. I've tried compiling with both mingw and VC, and neither path has worked for me. I've looked at all the SDL tutorials I could find, and none of them work. Thanks for any help!

mandrav:
Please give us some more info:

Does the SDL template project build?
What SDL package do you use? Built it yourself or binary?

Yiannis.

rickg22:
Note: When you create a new project from codeblocks, there's an SDL project in there. That's the "SDL project template" Yiannis refers to.

sushi_cw:
Right, forgot to mention that step. :) Yes, I did use the SDL project template. The only thing I changed in the source was a slight edit of the include header (as mentioned above). The project would compile, but would NOT link.

As far as the SDL package I used, that turned out to be the problem. I checked the SDL website again and discovered that there are seperate packages for VC and for mingw... the mingw package turned out to be what I needed. It works with the mingw compiler and the SDL template "out of the box" as it should. Well, mostly... the program compiles and links, although running it doesn't produce the expected result.

Thanks for the help!



Navigation

[0] Message Index

Go to full version