tunnuz
tunnuz

Reputation: 24018

How to prevent double inclusion of a .lib when inheriting dependencies?

I'm working to a Visual C++ 2008 project which needs two libraries (A and B), both of them are compiled using a a particular .lib (C). When I compile my project I'm asked for C again, and thus I specify it in the additional libraries. Then everything goes ok until the linking phase, where I get errors for external symbols which are defined more than once. Is there a way to exclude them from the linking?

Thank you
Tommaso

Upvotes: 1

Views: 205

Answers (2)

tunnuz
tunnuz

Reputation: 24018

I resolved the problem by specifying /NODEFAULTLIB:library in the linker options. I don't know what this should mean ... Visual Studio suggested it.

Upvotes: 0

sbi
sbi

Reputation: 224159

This sounds like you're adding two different versions of this library (Debug/Release, MT/ST etc.). Otherwise the linker would just ignore the second one.

Upvotes: 2

Related Questions