[英]Expected ; after top level declarator, error in xcode
I am working with this utils.c file in xcode, which has the following:我正在 xcode 中使用这个utils.c文件,它具有以下内容:
#if FF_API_AVCODEC_OPEN
int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
{
return avcodec_open2(avctx, codec, NULL);
}
It's causing an Expected ; after top level declarator
它导致了Expected ; after top level declarator
Expected ; after top level declarator
, error (during build) in xcode at this line: int attribute_align_arg avcodec_open(....
Expected ; after top level declarator
int attribute_align_arg avcodec_open(....
,xcode 中的错误(在构建期间)在这一行: int attribute_align_arg avcodec_open(....
Why?为什么? and what should I do to resolve this.我该怎么做才能解决这个问题。
Thank you.谢谢你。
I ran into this error when using the auto completion.我在使用自动完成时遇到了这个错误。
When inserting the parameter of a function, XCode will insert placeholders that need to be edited but show as completely valid C++ in the GUI.当插入函数的参数时,XCode 将插入需要编辑但在 GUI 中显示为完全有效的 C++ 的占位符。
It took me some hours until I checked my file in another editor, revealing that instead of the expected:我花了几个小时,直到我在另一个编辑器中检查我的文件,发现而不是预期的:
void func(int a) void func(int a)
XCode had actually inserted XCode实际上已经插入
void func(<#int a#>) void func(<#int a#>)
In the XCode editor the parameter shows as int a
with a light blue background, so it isn't easy to spot as the source of the compiler error.在 XCode 编辑器中,参数显示为带有浅蓝色背景的int a
,因此不容易将其视为编译器错误的来源。
I got a similar error in xcode for the following code:对于以下代码,我在 xcode 中遇到了类似的错误:
#ifndef Parser_hpp
#define Parser_hpp
#include <string>
std::string getTitle();
#endif /* Parser_hpp */
The reason was that the code had to be wrapped with C++ preprocessor directives.原因是代码必须用 C++ 预处理器指令包装。 Like so:像这样:
#ifndef Parser_hpp
#define Parser_hpp
#if defined __cplusplus
#include <string>
std::string getTitle();
#endif /* __cplusplus */
#endif /* Parser_hpp */
I ran into this after moving a class to a dynamic library but leaving the old import around.在将一个类移动到动态库但保留旧的导入后,我遇到了这个问题。 Commenting out the old import resolved the issue (but it wasn't the first thing I looked for as the dynamic library import was earlier and also showed an error).注释掉旧的导入解决了这个问题(但这不是我寻找的第一件事,因为动态库导入更早并且还显示了错误)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.