Sign in to follow this  

Static libs, and how to use them...

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

Im sorry in advance if this question has been asked and answered before, but I didn't find it with search or ask.com... Ok, so I have a static library project called SDLDevice, and it outputs a .lib file called 'SDLDevice.lib'. The main header, for which all functionality is supposed to be 'SDLDevice.h' (I don't know if there is a setting somewhere to make a particular header the lib's header, or if its a quasi arbitrary thing). At any rate. I have another project called 'Test' that surprising wants to use this lib. Now, so far what I have done is to add 'SDLDevice.lib' to that project's files as well as 'SDLDevice.h'. However, when I compile my program it doesn't work. currently, I am the 'SDLDevice.h' in my source (no problems there) but I get a bunch of undefined symbol errors, so obviously I haven't set up my lib properly. Im just wondering how to set up/use static libs in VC++.NET

Share this post


Link to post
Share on other sites
I think we need a bit more information about how you are creating the .lib and how you are adding the .lib and .h to your test project, since on the face of it it sounds as if you are in the right area.

When you say you are getting undefined symbol errors, are these compiler or linker errors? Knowing that would probably be a good first step to diagnosing the problem.

The other thing that just occurred to me is to ask if you are also including any libs that your lib depends upon. I'm assuming from the name that this is an SDL wrapper of some kind. If the lib depends on an SDL .lib, you need to add this lib to your test project as well as your own.

Alternatively, with VC you can do

#pragma comment(lib,"sdlwhatever.lib")

in your SLDDevice.h to have this done automatically in any project that includes it, but beware this is not standard C++.

[Edited by - EasilyConfused on October 3, 2006 2:30:27 AM]

Share this post


Link to post
Share on other sites

This topic is 4095 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.

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