• Advertisement
Sign in to follow this  

Linker Errors [Now Code::Blocks]

This topic is 3318 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay, so I'm trying to port my project from VC++ to Bloodshed, and I've gotten everything down to a few errors. I've taken a screenshot that has my linker list, and build info. Can someone take a look at it and tell me how to correct these errors? [Edited by - Robo-Link on December 17, 2008 5:52:35 PM]

Share this post


Link to post
Share on other sites
Advertisement
According to the bloodshed site it was last updated nearly 4 years ago. Why are you trying to port to an out of date unsupported unused compiler? Stick with MSVC++ if I were you...

Share this post


Link to post
Share on other sites
Quote:
Original post by Cantos
If you want a MinGW build environment, you can try Code::Blocks instead.


Thanks. I'm using code blocks now. I have just one error:
C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\libmingw32.a(main.o):main.c:(.text+0x104)||undefined reference to `_WinMain@16|

I'm linking to SDL like this:
Build settings -> [project name] -> Linker Settings:
opengl32
GlU32
SDL
SDLmain

And Build settings -> [project name] -> Search Directories -> Compiler:
..\..\SDL-devel-1.2.13-mingw32\SDL-1.2.13\include
And Build settings -> [project name] -> Search Directories -> Linker:
..\..\SDL-devel-1.2.13-mingw32\SDL-1.2.13\lib

Also, I have a Main referenced at main.cpp as int main(int argc, char **argv[])

Can someone please help?

Share this post


Link to post
Share on other sites
Quote:
Original post by Robo-Link
Quote:
Original post by Cantos
If you want a MinGW build environment, you can try Code::Blocks instead.


Thanks. I'm using code blocks now. I have just one error:
C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\libmingw32.a(main.o):main.c:(.text+0x104)||undefined reference to `_WinMain@16|

I'm linking to SDL like this:
Build settings -> [project name] -> Linker Settings:
opengl32
GlU32
SDL
SDLmain

And Build settings -> [project name] -> Search Directories -> Compiler:
..\..\SDL-devel-1.2.13-mingw32\SDL-1.2.13\include
And Build settings -> [project name] -> Search Directories -> Linker:
..\..\SDL-devel-1.2.13-mingw32\SDL-1.2.13\lib

Also, I have a Main referenced at main.cpp as int main(int argc, char **argv[])

Can someone please help?


Yes, you defined the wrong entrypoint for your program.

Instead of a main(), you need a WinMain according to this specification:

int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
);


Toolmaker

Share this post


Link to post
Share on other sites
Try a block like this around your main() function:



extern "C" {

int main(int argc, char *argv[])
{
...
}

}


Share this post


Link to post
Share on other sites
IIRC if you specify -lsdlmain _before_ -lsdl in your linker settings it should help

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement