Jump to content
  • Advertisement
Sign in to follow this  
Uriel

Static linking question

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

Hello! I have a following problem: I have created class using standard string. I tried to compile it to .lib, so it could be easly added to other projects. When i add that lib to any other project that also utilizes strings - im unable to link because string is already defined... i supposet there is some simple solution... any help on that one?

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure why you're getting that problem. Just because you're using strings in two separate classes you shouldn't get a redefinition error. As a quick workaround to your problem you can put all of your classes in the lib into their own namespace. This should clear up any redefinition problems.

Share this post


Link to post
Share on other sites
Your lib and main program are probably linked to different versions of the standard libs. You can either force the linker to ignore symbols from the problem std lib or just rebuild them with the same lib. I tend to use 'multi-threaded dll' or 'multithreaded debug dll' for everything - seems to be the most forgiving.

If you're using msvc you can find the settings for this stuff in your project properties, under the 'c++/code generation' and 'linker/input' pages.

Share this post


Link to post
Share on other sites


*solved*

/NODEFAULTLIB:LIBCD helped after all. Thanks all for the help. I had a solution on screen all that time, heh.

[Edited by - Uriel on August 15, 2005 2:06:18 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

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