我在xcode中使用这个utils.c文件,它具有以下内容:
#if FF_API_AVCODEC_OPEN
int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
{
return avcodec_open2(avctx, codec, NULL);
}
Run Code Online (Sandbox Code Playgroud)
这导致Expected ; after top level declarator
xcode中的错误(在构建期间):int attribute_align_arg avcodec_open(....
为什么?我该怎么做才能解决这个问题.
谢谢.
Zor*_*ord 41
我在使用自动完成时遇到了这个错误.
插入函数的参数时,XCode将插入需要编辑的占位符,但在GUI中显示为完全有效的C++.
我花了几个小时直到我在另一个编辑器中检查了我的文件,揭示了它而不是预期:
void func(int a)
XCode实际上已插入
void func(<#int a#>)
在XCode编辑器中,参数显示为int a
浅蓝色背景,因此很难发现编译器错误的来源.
小智 8
我在 xcode 中遇到类似的错误,代码如下:
#ifndef Parser_hpp
#define Parser_hpp
#include <string>
std::string getTitle();
#endif /* Parser_hpp */
Run Code Online (Sandbox Code Playgroud)
原因是代码必须用 C++ 预处理器指令包装。就像这样:
#ifndef Parser_hpp
#define Parser_hpp
#if defined __cplusplus
#include <string>
std::string getTitle();
#endif /* __cplusplus */
#endif /* Parser_hpp */
Run Code Online (Sandbox Code Playgroud)