Skip to main content
gamedev.net
🔒 Locked

'Undefined Reference' with buried SDL

Started by Servant of the Lord Jul 30, 2006 at 4:01 PM 0 replies 750+ views
Original Post
Servant of the Lord
Servant of the Lord
I'm using C++ and the Dev C++ IDE. I have a few simple SDL based functions for loading and applying surfaces(Pretty much lazyfoo's actaully) and I placed them in a static libary so I don't need to go retype them each project. My problem is that, because it uses SDL, it creates undefined references in the project using the lib, although the lib itself compiles fine. I think it has to do with the fact that SDL is getting initialized in my project, after the lib has been included. I've made sure I use the functions after I initialize SDL and setup everything, but I get the 'udefined references' anyway. How do I get around this? I can't go and initialize and quit SDL for the lib's functions, or that would undoubtably cause errors. Both the lib and my project include the relevant files, and the functions themselves work if they're actaully in the project, but not if they're in a libary. Thanks,
Kylotan
Kylotan
The undefined references mean it can't find the reference at link time. Moving the order of your code around won't change this, because that only affects run-time dependencies. You may need to change the compilation options of your static library. It probably needs to be exactly the same as your normal SDL program (eg. multithreaded dll, if I remember correctly).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.