Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Emmanuel77

How to include Libs in a lib

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

Hi, I''m using VC 6 and I would like to create a static lib that coutains others lib. For instance, I would like to create a 3D engine lib. This lib should use the libjpeg. -> For developpment reasons, I would like to use the libjepg ( and others ) as static lib, to use them in others projects. -> When I give my engine lib, I would like to only give this lib ( not asking to link to my lib, the libjpeg, ... ) How could my engine lib coutains other lib ?? Thank for any help, Emmanuel

Share this post


Link to post
Share on other sites
Advertisement
In VC it is possible to put a dericitve in a header to link a certain library:

#ifdef _MSC_VER // non VC compilers ignore this

#pragma comment(lib,"libjpeg")
#pragma comment(lib,"myengine")
#endif

Share this post


Link to post
Share on other sites
You don''t need to add the lib file you your static library as no linking is performed when the static library is built - so instead of adding the lib file to your static lib just add it to the project which is using your static lib

Share this post


Link to post
Share on other sites
There would be another way to do what you''re wanting to do: if you recompile the source to the lib you''re wanting to include into object files (or whatever your compiler does), and include those files along with your source files when you build the final lib. If you''re using gcc, this involves using "gcc -c ...", and then "ar rc ..." to create the final lib (as you may already know). If you''re using MSVC, you''ll have to make the libjpeg sources a part of your project and configure everything the way libjpeg needs it...I wish you luck if that''s your case.

Twilight Dragon

Share this post


Link to post
Share on other sites
twanvl :
Yes that''s about the better solution I found...

Spudder :
No, what I want is producing only ONE static lib at the end... ( I already said that in my previous post )

TDragon :
I want to keep the other libs as libs...


On a side note, in VC6, one can add a static lib by selecting ''add files in the project'' on a right clic on the project. My issue with this solution is I can''t provide a Debug and a Release file...

So I guess I''m stick with the pragma solution, but I don''t like it because it''s in the sources...

Emmanuel

Share this post


Link to post
Share on other sites
On a side note, in VC6, one can add a static lib by selecting ''add files in the project'' on a right clic on the project. My issue with this solution is I can''t provide a Debug and a Release file...

You can add .lib files to your project in exactly the same way as you add .cpp files to it.


“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
— Brian W. Kernighan

Share this post


Link to post
Share on other sites
meh use dlls, so u only have 3 files.. .h,.dll,.lib

i know its not what u want, but i was doing the same thing a while back, but im happy with dlls now anyway

Share this post


Link to post
Share on other sites

  • 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!