0

我正在尝试将 C 和 C++ 代码一起添加,但最终以IntelliSense:expected a declaration.

例如 abc.cpp

#include "abc.h"
#ifdef __cplusplus
extern "C"
{
#endif
#include "C_headerfiles.h"
...
...//Body of C code
#ifdef _cplusplus
}
#endif
...
...//Body of C plus plus code

#ifdef __cplusplus
extern "C"       //`IntelliSense:expected a declaration
{
#endif
...
...//Body of C code
#ifdef _cplusplus
}
#endif
4

1 回答 1

1

我已经解决了这个问题:需要添加extern C only oncenot again and again

#include "abc.h"
#ifdef __cplusplus
extern "C"
{
#endif
#include "C_headerfiles.h"
...
...//Body of C code

...
...//Body of C plus plus code


...
...//Body of C code
#ifdef _cplusplus
}
#endif
于 2013-01-04T14:45:39.110 回答