C2059 语法错误 'string' ?
C2059 syntax error 'string' ?
extern "C"
{
#endif
#include <stdint.h>
#include <limits.h>
#include "attributes.h"
}
#endif
我加入了extern "C" { }
然后我得到了C2059 string
错误所以我试图使用#endif
,现在我有另外4个错误。
Error 1 error C2059: syntax error : 'string' d:c-sharpc++
compilingconsoleapplication7consoleapplication7libavutilrational.h 31 1
ConsoleApplication7
如何修复这个字符串错误?
猜测,您是否包括来自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
相关文章:
- 1d 智能指针不适用于语法 (*)++
- 助记符和指向成员语法的指针
- 有人能分解一下这个c++模板的语法吗
- C++避免重复声明的语法是什么
- QMetaObject invokeMethod的基于函数指针的语法
- cppcheck在const std::string[]上引发警告
- 将std::string传递给WriteConsole API
- 这个语法std::class<>{}(arg1, arg2) 在C++中是什么意思?
- 为std::string的某个索引赋值
- 为什么包含windows.h会产生语法错误,从而阻止类的实例化?(C2146,C2065)
- std中有类似find_last_of的函数,而string中没有
- 使用 std::string () const 函数启动线程或未来
- 使用char类型将decimal转换为string,将string转换为decimal
- C++ std::字符串语法 "new (&y) std::string(x);"
- 是否有任何 DirectX 11 (HLSL 5.0) 等效于 DirectX 9 纹理"string function"语法?
- 错误 C2061:语法错误:标识符'string'
- 如何在VC++中将TChar[]数组转换为std::string.语法帮助
- 语法错误:标识符'string'错误 C2061
- C2059 语法错误 'string' ?
- C2061:语法错误:标识符'string' - 行为异常