FIX: Global Overloaded Delete Operator Causes LNK2005Last reviewed: September 19, 1997Article ID: Q140440 |
4.00
WINDOWS NT
kbprg kbbuglist kbfixlist
The information in this article applies to:
SYMPTOMSWhen globally overloading operator delete, the linker may generate the following errors when building in the debug mode and using the static C run-time libraries:
error LNK2005: "void __cdecl operator delete(void *)"(??3@YAXPAX@Z) already defined in file.obj fatal error LNK1169: one or more multiply defined symbols found RESOLUTIONThe problem only appears with the static C run-time libraries for the debug mode; it does not occur when using the release mode. Also at this time, the problem is noted to occur only when an iostream object is linked in. For example, in the code fragment listed in the "Steps to Reproduce Problem" section of this article, if you change the statement to output to "cout" into a comment inside main(), the problem does not occur. To work around this problem:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 4.1.
MORE INFORMATION
Steps to Reproduce ProblemBuild the following program as a console application using the debug mode.
// test.cpp #include <iostream.h> #include <malloc.h> void operator delete (void *p){ free (p);}
void main(){ cout << "main" << endl;}
|
Additional reference words: 4.00 4.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |