Impl in header file 
Author Message
 Impl in header file

How can I include implmentation in a header file and keep it from getting
multiply defined when it's contents are accessed by several .cpp files?

I'm getting the following errors and the strange thing is that I'm using the
class/functions in other files in my project as well as EMailMessage.cpp,
but it seems to be the only one that's conflicting with stdafx.cpp.  I am
using precompiled headers and I put the header in question in stdafx.h.  I
also inclosed the implementations with #ifndef, etc...

EMailMessage.obj : error LNK2005: "public: bool __thiscall

defined in DVEmailSupport.obj
EMailMessage.obj : error LNK2005: "public: double __thiscall

in DVEmailSupport.obj
StdAfx.obj : error LNK2005: "public: bool __thiscall

defined in DVEmailSupport.obj
StdAfx.obj : error LNK2005: "public: double __thiscall

in DVEmailSupport.obj
EMailMessage.obj : warning LNK4006: "public: bool __thiscall

defined in DVEmailSupport.obj; second definition ignored
EMailMessage.obj : warning LNK4006: "public: double __thiscall

in DVEmailSupport.obj; second definition ignored
StdAfx.obj : warning LNK4006: "public: bool __thiscall

defined in DVEmailSupport.obj; second definition ignored
StdAfx.obj : warning LNK4006: "public: double __thiscall

in DVEmailSupport.obj; second definition ignored
   Creating library Debug/EMailSupport.lib and object Debug/EMailSupport.exp
Debug/EMailSupport.dll : fatal error LNK1169: one or more multiply defined
symbols found

Can anyone help?

Thanks,

Kevin



Tue, 14 Oct 2003 05:04:37 GMT  
 Impl in header file
Awesome!  That worked great!

Thanks, Igor!

Kevin


Quote:
> The functions have to be marked inline or defined within the class
> --
> With best wishes,
>     Igor Tandetnik



> > How can I include implmentation in a header file and keep it from
getting
> > multiply defined when it's contents are accessed by several .cpp files?

> > I'm getting the following errors and the strange thing is that I'm using
> the
> > class/functions in other files in my project as well as
EMailMessage.cpp,
> > but it seems to be the only one that's conflicting with stdafx.cpp.  I
am
> > using precompiled headers and I put the header in question in stdafx.h.
I
> > also inclosed the implementations with #ifndef, etc...

> > EMailMessage.obj : error LNK2005: "public: bool __thiscall

already
> > defined in DVEmailSupport.obj
> > EMailMessage.obj : error LNK2005: "public: double __thiscall

defined
> > in DVEmailSupport.obj
> > StdAfx.obj : error LNK2005: "public: bool __thiscall

already
> > defined in DVEmailSupport.obj
> > StdAfx.obj : error LNK2005: "public: double __thiscall

defined
> > in DVEmailSupport.obj
> > EMailMessage.obj : warning LNK4006: "public: bool __thiscall

already
> > defined in DVEmailSupport.obj; second definition ignored
> > EMailMessage.obj : warning LNK4006: "public: double __thiscall

defined
> > in DVEmailSupport.obj; second definition ignored
> > StdAfx.obj : warning LNK4006: "public: bool __thiscall

already
> > defined in DVEmailSupport.obj; second definition ignored
> > StdAfx.obj : warning LNK4006: "public: double __thiscall

defined
> > in DVEmailSupport.obj; second definition ignored
> >    Creating library Debug/EMailSupport.lib and object
> Debug/EMailSupport.exp
> > Debug/EMailSupport.dll : fatal error LNK1169: one or more multiply
defined
> > symbols found

> > Can anyone help?

> > Thanks,

> > Kevin



Tue, 14 Oct 2003 05:37:52 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Impl in header file

2. C Header files including header files, mutually referencing typedefs

3. STL header files vs non-STL header files

4. header in header files

5. Header files shall not #include any other headers

6. #ifndef/#ifdef problems in my header file (conditional header inclusion)

7. Calloc's zero initializing [was Re: 5 tap IIR Filter Impl]

8. problems using one header file for multiple source files

9. looking for a file list all functions in all header files

10. Fortran include file to C header file conversion

11. US-GA-Athens-C-Java-Javascript-Internet Tools-Software Development-Software Impl

12. Makefiles, Libraries, Object files, Header files in TurboC++ (borland)

 

 
Powered by phpBB® Forum Software