Re: LNK4006 in .NET 2003
- From: Ulrich Eckhardt <eckhardt@xxxxxxxxxxxxxx>
- Date: Mon, 10 Jul 2006 13:33:10 +0200
piwiix wrote:
Let's explain the structure of my solution :[...]
- under Visual Studio .Net 2003
- I've got all source files
- 1st library BasicLibrary.lib : class defined in BasicClass.h implemented
in BasicClass.cpp
- 2nd library DepLib1.lib -> only dependends on BasicLibrary.lib, no
include - 3rd library DepLib2.lib -> only dependends on BasicLibrary.lib,
no include - 4th library TopLibrary.lib -> dependends on BasicLibrary.lib,
DepLib1.lib and DepLib2.lib, no include
- Dependencies are intended to make header files available in only one
directory and avoid many include paths.
- All libraries have same preprocessors definitions (WIN32;_DEBUG;_LIB)
and runtime library types (/MLd)
Results :
- Compilation of BasicLibrary.lib : OK
- Compilation of DepLib1.lib : OK
- Compilation of DepLib2.lib : OK
- Compilation of TopLibrary.lib : NOK even though only warnings are
displayed
DepLib2.lib(BasicClass.obj) : warning LNK4006: "public: __thiscall
CBasicClass::CBasicClass(void)" (??0CBasicClass@@QAE@XZ) already defined
in BasicLibrary.lib(BasicClass.obj) ; second definition ignored
The reason is that, other than would be the case for e.g. a DLL, a static
library that links another static library then includes that library
completely, instead of just referencing that lib. Therefore, symbols of
BasicLibrary are duplicated in the other two libs.
Can you explain me please how to get rid of these warnings WITHOUT pragma
directives or using FORCE option or changing dependencies ?
Or is it simply impossible ???
I've never seen the need to use the IDE's dependencies for headers, didn't
even know it worked. So, if you could change includes so that you don't
need multiple dependencies on one static lib that should solve your
problems. Other than that, I only see that you could change to creating
DLLs which don't suffer said problems.
Uli
.
- References:
- LNK4006 in .NET 2003
- From: piwiix
- LNK4006 in .NET 2003
- Prev by Date: Re: EVC++: compile errors disappear when preprocessor output is on
- Next by Date: Re: LNK2019: unresolved external symbol - What am I forgetting?
- Previous by thread: Re: LNK4006 in .NET 2003
- Next by thread: Adding a view to an MDI project
- Index(es):
Relevant Pages
|