• Advertisement
Sign in to follow this  

question about .lib in visual c++

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

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
Advertisement
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
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++.

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
Sign in to follow this  

  • Advertisement