Re: LNK4006 warnings turning to LNK2005 errors, help please
- From: "Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@xxxxxxxxxxxxxxx>
- Date: Fri, 21 Oct 2005 11:56:42 -0700
"George P Boutwell" <GeorgePBoutwell@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:76404BE6-5B28-4103-9992-C29DBA741DF6@xxxxxxxxxxxxxxxx
> I have a static library and a dll developed in another environement.
> I've
> been working on porting them and I have most the issues worked out of
> them.
> The problem I'm seeing now is that the static library and dll compile fine
> in
> the other environment, but get an huge amount of warnings during the
> library
> on lots of symbols which seem to be the same symbols that turn into error
> LNK2005 when I compile the DLL (it uses the library).
>
> As near as I can tell the symbols that are being problematic are
> functions
> and methods that are defined (not just declared, but have a body too) in
> the
> header files. I've tested this theory by moving some of the
> implementations
> to the unit and that fixes them. I was wondering if there is a compiler
> switch or something where I could tell it to not treat the function as an
> error in that situation. There are a lot of them and the library and dll
> work just fine in the other environment.
Functions that are defined in header files in header files need to be inline
function or they'll be multiply defined.
If you're writing C, there's no portable way to do this, but VC++ recognizes
the non-standard __inline decoration. If you're writing C++, just add
inline to your function declaration and you're good to go.
inline void foo() {}
-cd
.
- Prev by Date: Re: LNK4006 warnings turning to LNK2005 errors, help please
- Next by Date: CreateProcess and the command line
- Previous by thread: Re: LNK4006 warnings turning to LNK2005 errors, help please
- Next by thread: CreateProcess and the command line
- Index(es):
Relevant Pages
|