The information in this article applies to:
SYMPTOMSAttempting to reference a function from the STD C++ library header <cstdlib> using the namespace STD (for example, std::exit(0)) causes the compiler to emit a C2653 or a C2039 (depending upon whether or not namespace "STD" is defined at the point where the error is emitted). CAUSE
<cstdlib> does not define the namespace "STD". This is contrary to the VC++ documentation, which says: "Include the standard header <cstdlib> to effectively include the standard header <stdlib.h> within the std namespace." RESOLUTIONTo work around the problem, place the "#include <cstdlib>" in the namespace "STD". STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. MORE INFORMATIONAttempting to compile the following will cause the compiler to display the following error:
However, attempting to compile the following causes the compiler to display the following error:
In the first case, the C2653 is displayed, because the namespace "STD" has not been defined. In the second case, the C2039 is displayed, because the namespace "STD" has been defined (in the header <vector>), but the function exit is not part of that namespace. To work around the problem in either case, simply enclose the "#include <cstdlib>" in the namespace "STD", as follows:
Additional query words:
Keywords : kbCompiler kbCPPonly kbVC600bug kbDSupport kbGrpVCCompiler |
Last Reviewed: January 3, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |