Sign in to follow this  
Robo-Link

Linker Errors [Now Code::Blocks]

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this