views:

61

answers:

2

Hello, 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

+2  A: 

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.

sbi
Both A and B are linked against the same C.lib
tunnuz
@tunnuz: Are the external symbols the linker shouts at you even from that lib? Or are they from the run-time lib? If the latter, then that would mean you're trying to link in different versions of the RTL.
sbi
The symbols are from the shared .lib.
tunnuz
A: 

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

tunnuz