C2059语法错误“字符串"? [英] C2059 syntax error 'string' ?
本文介绍了C2059语法错误“字符串"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
extern "C"
{
#endif
#include <stdint.h>
#include <limits.h>
#include "attributes.h"
}
#endif
我添加了 extern"C" {}
然后我得到 C2059字符串
错误所以我尝试使用 #endif
,现在又出现了4个错误.
I added extern "C" { }
Then i got the C2059 string
error
So i tried to use #endif
, now i have another 4 errors.
Error 1 error C2059: syntax error : 'string' d:\c-sharp\c++
compiling\consoleapplication7\consoleapplication7\libavutil\rational.h 31 1
ConsoleApplication7
如何解决此字符串错误?
How can i fix this string error ?
推荐答案
猜测一下,您是否包含C源文件中的这段代码?
At a guess, are you including this code from a C source file?
外部"C" {
防护仅由C ++要求(或理解).您可以从C文件中省略它们,应将它们包括在C ++文件中,并应在头文件中使用 __ cplusplus
ifdef保护它们.
extern "C" {
guards are only required (or understood) by C++. You can omit them from a C file, should include them in a C++ file and should guard them with a __cplusplus
ifdef in a header file.
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <limits.h>
#include "attributes.h"
#ifdef __cplusplus
}
#endif
这篇关于C2059语法错误“字符串"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文