Re: LNK4006 warnings turning to LNK2005 errors, help please
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Fri, 21 Oct 2005 13:53:58 -0500
On Fri, 21 Oct 2005 11:17:02 -0700, "George P Boutwell"
<GeorgePBoutwell@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> 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.
>
>Any suggestions or ideas?
Non-inline functions defined in headers tend to give you multiple
definition errors. Member functions defined outside a class are non-inline
by default. You should either define member functions inside the class
body, or you should declare them inline. Non-member functions must be
declared inline if you define them in headers. The exception concerns
templates, because the compiler will permit multiple non-inline
instantiations of a template specialization and discard all but one.
--
Doug Harrison
Visual C++ MVP
.
- Prev by Date: Re: CListBox::CompareItem
- Next by Date: Re: LNK4006 warnings turning to LNK2005 errors, help please
- Previous by thread: Re: Can I use Dll which built on VC.Net in VC6? another question insid
- Next by thread: Re: LNK4006 warnings turning to LNK2005 errors, help please
- Index(es):
Relevant Pages
|