as simple as that. Make it as a requirement that the client of
those libraries links against it and you are done.
On Nov 6, 10:09 am, Tim Roberts <t...@probo.com> wrote:
Mousam <mousam.du...@gmail.com> wrote:
I am developing an application in C++ using VS 2005. My project
uses three static libraries, Lib1, Lib2 and Lib3. Lib2 links with Lib1
and Lib3 links with both Lib1 and Lib2. Thus Lib1 is linking with Lib3
via 2 different paths.
1. Lib1 is directly linking with Lib3.
2. Lib1 is indirectly linking with Lib3 via Lib2.
Now my question is, Is there any way (either using pragmas or using
IDE specific settings or any other way) to disable/remove multiple
inclusion of Lib1 in Lib3?
Because of this multiple inclusion of Lib1 in Lib3 I am getting
following link warnings while building Lib3.
1>Lib2.lib(ClassLib1.obj) : warning LNK4006: "public: void __thiscall
ClassLib1::Method1(void)" (?Method1@ClassLib1@@QAEXXZ) already defined
in Lib1.lib(ClassLib1.obj); second definition ignored
1>Lib2.lib(ClassLib1.obj) : warning LNK4221: no public symbols found;
archive member will be inaccessible
You have described the problem incorrectly. The issue is that you have
included ClassLib1.obj in both Lib1.lib and Lib2.lib. The solution is,
don't do that.
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
Hi Alexander, Tim
Thanks for the prompt response.
Remove the reference to Lib1 from Lib3. You already get it via
Lib2.
Yeah this can be done, but the thing is I don't want to always rely
on lib2 to use lib1, I mean in future lib2 may remove lib1 from its
dependency list, in that case I will have to update Lib3 to use Lib1.
Actually Lib1 is a very common library say a string library, most of
the projects (lib/exe/dll) need this library, some projects might want
to use some other string libs than Lib1 and therefore I want to
explicitly specify Lib1 in each project which uses Lib1.
You have described the problem incorrectly. The issue is that you have
included ClassLib1.obj in both Lib1.lib and Lib2.lib. The solution is,
don't do that.
No, actually ClassLib1.obj is part of Lib1 and in Lib3 it is getting
link via two paths,
1. Directly from Lib1,
2. Indirectly from Lib1 via Lib2 as Lib2 is also linked with Lib1.
Thanks & Regards,
Mousam Dubey