I am working with this utils.c file in xcode, which has the following:
#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
, error (during build) in xcode at this line: 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.
It took me some hours until I checked my file in another editor, revealing that instead of the expected:
void func(int a)
XCode had actually inserted
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.
I got a similar error in xcode for the following code:
#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. Like so:
#ifndef Parser_hpp
#define Parser_hpp
#if defined __cplusplus
#include <string>
std::string getTitle();
#endif /* __cplusplus */
#endif /* Parser_hpp */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With