Jump to content
  • Advertisement
Sign in to follow this  
methinks

Linking woes

This topic is 4441 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

I'm trying to add SDL support to a project I'm working on, and I've got it to the point where it compiles, but doesn't quite link. What I end up with is the following error: C:\Program Files\CodeBlocks\lib/libmingw32.a(main.o):main.c:(.text+0x106): undefined reference to `WinMain@16' I know that it's a matter of telling the compiler/linker of pointing to certain files, but I don't get the how and where. My personal problem is that most of the books and resources which teach you how to program, only teach you to CODE. While they might explain the theory behind the linking, they never explain what actually has to be done. Other examples only show how to set up and link specific SDKs in specific environments... So I guess I'm asking two things: Could someone explain the whole linking of lib, include, .a, and dlls, or at least point me to a resource that explains it all? Does anybody know how to fix my specific problem? (And don't tell me "just link your ide to x location, that's what brought on this post in the first place) I'm trying to compile SDK on CodeBlocks, running on XP, using GCC (Ming). Thanks

Share this post


Link to post
Share on other sites
Advertisement
Try linking with "-lmingw32 -lSDLmain -lSDL".

Just copy and paste that, sans the quotation marks, into your linker options. I dont know where that is in code blocks.

Share this post


Link to post
Share on other sites
Thanks, it got me a bit farther. Now I have a problem linking to SDL_main:
/home/hercules/release/SDL-1.2.10/src/main/win32/SDL_win32_main.c:217: undefined reference to `SDL_main'

While just adding the tags in helps with the problem, it doesn't explain what exactly I'm doing, which leads me back to point #1: could somebody point me to where linker and compiler options, paths and includes are explained properly?

Share this post


Link to post
Share on other sites
See the question "I get "Undefined reference to 'SDL_main'" ..." on SDL's Windows FAQ

main() needs to look like this:

int main(int argc, char *argv[])

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!