Sign in to follow this  
staticVoid2

question about .lib in visual c++

Recommended Posts

do you have to supply all header files in a library with a .lib file to use the library in a different project?. I'm trying to link in visual c++ 8.0 and the only way its letting me is if I create a folder with all headers and the .lib file then link the .lib and include any headers I need.

Share this post


Link to post
Share on other sites
For the same reason you need to have header files when you have .cpp files in another project.
You can think of a static lib as just all of the .cpp files bundled into one file.

The compiler still needs to know what's in the .lib file - which is what the header file tells it.


EDIT: Err, I misread the question - Yes, you do need to. For the reasons above.

Share this post


Link to post
Share on other sites
Quote:
Original post by staticVoid2
thanx, I thought the .lib acted like a .zip for header files, because I linked to ddraw.lib and instantly was able to access ddraw.h even though I didn't add any extra include paths to visual c++.


The DirectX SDK set up the header lookup paths when you ran the installer.

You would have found that the headers were visible whether or not you added the lib to your project, but you would have simply experienced linker errors until you did so.

[Edited by - fpsgamer on May 9, 2008 9:37:35 PM]

Share this post


Link to post
Share on other sites
Actually, any headers that are fully contained to the libraries and won't be needed by third parties can be excluded. Granted for your case, it sounds like you need everything.

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