linker error after formatting code 
Author Message
 linker error after formatting code

i used EDIT/ADVANCED/FORMAT SELECTION
to format 2 of my source files

and although i wouldnt know what that has to with it i now get these linker
errors:

Linking...
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator

nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void

Debug/assaMFC.exe : fatal error LNK1169: one or more multiply defined
symbols found

what would cause it or more importantly how do i fix this?

stdafx.cpp and stdafx.h are not the files i tried to format

i used redo on both files (and found out i gotta click undo for each line
that was reformatted/instead of just undoing all the reformatting at once)

i dont use new or delete in one of the file, the other file is created by
the MFC app wizard and the code i added to it also doesnt use NEW or delete



Mon, 28 Jun 2004 02:46:09 GMT  
 linker error after formatting code


Fri, 19 Jun 1992 00:00:00 GMT  
 linker error after formatting code
i just remembered something......the code i have is because of the fact that
the prroject is set for the mfc libraries to be included statically and not
dynamic

however i do have VC++ pro here at work and had the same error when i sent
the project home and didnt switch to include the libraries dynamically

when i switch to dynamically linking the libs, it works fine, switching back
to link statically and i get those error message

truth being told, im not sure if the error message is identical but
remembering the static/dynamic issue made me look and only if i link
statically i get the error

maybe someone can better help me based on this additnional information.....

i also just before i got that error reinstalled the MSDN library
which seems just as unrelated to me as formatting the source........
since it just doesnt (seem to) make sense ill ask here...........

Quote:
> i used EDIT/ADVANCED/FORMAT SELECTION
> to format 2 of my source files

> and although i wouldnt know what that has to with it i now get these
linker
> errors:

> Linking...
> nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator

> nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator
delete(void

> Debug/assaMFC.exe : fatal error LNK1169: one or more multiply defined
> symbols found

> what would cause it or more importantly how do i fix this?

> stdafx.cpp and stdafx.h are not the files i tried to format

> i used redo on both files (and found out i gotta click undo for each line
> that was reformatted/instead of just undoing all the reformatting at once)

> i dont use new or delete in one of the file, the other file is created by
> the MFC app wizard and the code i added to it also doesnt use NEW or
delete



Mon, 28 Jun 2004 02:52:37 GMT  
 linker error after formatting code


Fri, 19 Jun 1992 00:00:00 GMT  
 linker error after formatting code
The message means that operator new and delete are both defined
twice, in libcmtd and nafxcwd. That's the static link multiple-threaded
C run time, and one of the MFC libraries.

Error messages of that sort usually mean that you are using conflicting
versions of the C run time.

However, I believe that this particular one is more subtle. It has to do
with the link order. MFC has to come first so that it's operator new
and delete will be used instead of the C run time new and delete. The
libraries are (intentionally) setup so that the reverse will not work, since
it is important that the MFC version be used.

The details are in a knowledgebase article somewhere.

Quote:

> i used EDIT/ADVANCED/FORMAT SELECTION
> to format 2 of my source files

> and although i wouldnt know what that has to with it i now get these linker
> errors:

> Linking...
> nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator

> nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void

> Debug/assaMFC.exe : fatal error LNK1169: one or more multiply defined
> symbols found

> what would cause it or more importantly how do i fix this?

> stdafx.cpp and stdafx.h are not the files i tried to format

> i used redo on both files (and found out i gotta click undo for each line
> that was reformatted/instead of just undoing all the reformatting at once)

> i dont use new or delete in one of the file, the other file is created by
> the MFC app wizard and the code i added to it also doesnt use NEW or delete



Mon, 28 Jun 2004 13:12:45 GMT  
 linker error after formatting code
thanks for the info bruce,

how come the order is now broke when i didnt change any of the sources other
than using edit/advance/format selection?
after that it was broke before that it worked fine, and i dont see how
formatting it would break it.......thats what keep sme clueless
any idea?


Quote:
> The message means that operator new and delete are both defined
> twice, in libcmtd and nafxcwd. That's the static link multiple-threaded
> C run time, and one of the MFC libraries.

> Error messages of that sort usually mean that you are using conflicting
> versions of the C run time.

> However, I believe that this particular one is more subtle. It has to do
> with the link order. MFC has to come first so that it's operator new
> and delete will be used instead of the C run time new and delete. The
> libraries are (intentionally) setup so that the reverse will not work,
since
> it is important that the MFC version be used.

> The details are in a knowledgebase article somewhere.


> > i used EDIT/ADVANCED/FORMAT SELECTION
> > to format 2 of my source files

> > and although i wouldnt know what that has to with it i now get these
linker
> > errors:

> > Linking...
> > nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator


LIBCMTD.lib(new.obj)

- Show quoted text -

Quote:
> > nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator
delete(void

> > Debug/assaMFC.exe : fatal error LNK1169: one or more multiply defined
> > symbols found

> > what would cause it or more importantly how do i fix this?

> > stdafx.cpp and stdafx.h are not the files i tried to format

> > i used redo on both files (and found out i gotta click undo for each
line
> > that was reformatted/instead of just undoing all the reformatting at
once)

> > i dont use new or delete in one of the file, the other file is created
by
> > the MFC app wizard and the code i added to it also doesnt use NEW or
delete



Mon, 28 Jun 2004 20:51:01 GMT  
 linker error after formatting code
thanks bruce i searched the knowledgebase and i found the part about my
error and you were right it had to do with the link order
why i didnt get that error much sooner since i did several clean/rebuilds
since i changed my class and finally broke it up into declaration and
implementation.....
i added #include "stdafx.h" to my myclass.cpp file and now itw roks again
like a charm
the knowledge base states afx.h takes care of the correct order....

thanks a bunch!


Quote:
> The message means that operator new and delete are both defined
> twice, in libcmtd and nafxcwd. That's the static link multiple-threaded
> C run time, and one of the MFC libraries.

> Error messages of that sort usually mean that you are using conflicting
> versions of the C run time.

> However, I believe that this particular one is more subtle. It has to do
> with the link order. MFC has to come first so that it's operator new
> and delete will be used instead of the C run time new and delete. The
> libraries are (intentionally) setup so that the reverse will not work,
since
> it is important that the MFC version be used.

> The details are in a knowledgebase article somewhere.


> > i used EDIT/ADVANCED/FORMAT SELECTION
> > to format 2 of my source files

> > and although i wouldnt know what that has to with it i now get these
linker
> > errors:

> > Linking...
> > nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator


LIBCMTD.lib(new.obj)

- Show quoted text -

Quote:
> > nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator
delete(void

> > Debug/assaMFC.exe : fatal error LNK1169: one or more multiply defined
> > symbols found

> > what would cause it or more importantly how do i fix this?

> > stdafx.cpp and stdafx.h are not the files i tried to format

> > i used redo on both files (and found out i gotta click undo for each
line
> > that was reformatted/instead of just undoing all the reformatting at
once)

> > i dont use new or delete in one of the file, the other file is created
by
> > the MFC app wizard and the code i added to it also doesnt use NEW or
delete



Mon, 28 Jun 2004 21:10:28 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Linker Errors : Static linking both STL and C code

2. Why do i get linker errors??? (Code included)

3. Linker Errors : Static linking both STL and C code

4. linker error again: unusual fatal error LNK1104

5. linker error 2001/compiler error 2893(templates and friend clases involved)

6. Linker Error : Internal Error on Pass2

7. Porting C++ code from VC6 to .NET: linker issues

8. Can linker report dead code?

9. Linker LNK4227 warning with managed cpp code

10. Linker warning code ?

11. Q:(code incl), how libs/linker are used ??

12. Friend linker error Visual C++ .NET 2003

 

 
Powered by phpBB® Forum Software