extern "C"
{
#endif
#include <stdint.h>
#include <limits.h>
#include "attributes.h"
}
#endif
Run Code Online (Sandbox Code Playgroud)
我添加了extern "C" { }
然后我得到了C2059 string错误所以我试图使用#endif,现在我有另外4个错误.
Error 1 error C2059: syntax error : 'string' d:\c-sharp\c++
compiling\consoleapplication7\consoleapplication7\libavutil\rational.h 31 1
ConsoleApplication7
Run Code Online (Sandbox Code Playgroud)
我该如何修复此字符串错误?
sim*_*onc 20
猜测,你是否从C源文件中包含此代码?
extern "C" {只有C++才需要(或理解)警卫.您可以从C文件中省略它们,应该将它们包含在C++文件中,并且应该__cplusplus在头文件中使用ifdef来保护它们 .
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <limits.h>
#include "attributes.h"
#ifdef __cplusplus
}
#endif
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12993 次 |
| 最近记录: |