Author Topic: linker errors  (Read 4541 times)

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
linker errors
« on: November 15, 2004, 02:36:03 pm »
When I want to build a project with wxwindows or SDL, I get the following error
Code: [Select]

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

Is there something to do about it without making my own WinMain?
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline sushi_cw

  • Single posting newcomer
  • *
  • Posts: 6
Re: linker errors
« Reply #1 on: August 26, 2005, 08:21:14 am »
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: [Select]
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'

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!

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: linker errors
« Reply #2 on: August 26, 2005, 08:37:08 am »
Please give us some more info:

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

Yiannis.
Be patient!
This bug will be fixed soon...

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: linker errors
« Reply #3 on: August 26, 2005, 06:06:17 pm »
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.

Offline sushi_cw

  • Single posting newcomer
  • *
  • Posts: 6
Re: linker errors
« Reply #4 on: August 27, 2005, 02:33:06 am »
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!