2013-01-04 60 views
0

我想补充的C和C++代码一起,但与得到上述错误的IntelliSense:expected a declaration结束。智能感知:预计在C++声明

e.g 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 
+0

我喜欢同样的错误发生两次。 – chris

+0

http://stackoverflow.com/a/1041880/1488917也许这将有助于。 – asheeshr

+0

您知道Intellisense错误只是提示吗?你是否试图建立? –

回答

1

我已经解决了这个问题:需要添加extern Conly onceagain 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 
+0

@All:感谢All –