PRB: C2059 Error Using extern "C" in .C Source FilesLast reviewed: July 25, 1997Article ID: Q133070 |
The information to this article applies to:
SUMMARYUse of "extern "C"" in source files that have a .C extension causes error C2059, and results in this error message:
error C2059:syntax error:'string' CAUSEIn the C language, the string-literal "C" is not recognized. It is used in C++ to prevent name decoration.
RESOLUTIONRemove the string-literal "C" in extern declarations, or use the following in the function declaration:
#ifdef __cplusplus extern "C" #endif STATUSThis behavior is by design.
MORE INFORMATION
Sample Code to Reproduce Behavior
/* Compile options needed: None The following program reproduces the behavior if ths source file has .C extension */ #include <windows.h> extern "C" _declspec(dllexport) BOOL WINAPI function1(void); BOOL WINAPI DllMain ( HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved) { // Other required code goes here. return TRUE; } |
Additional query words: 9.0 9.00 9.1 9.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |