[英]Expected ; after top level declarator, error in xcode
我正在 xcode 中使用這個utils.c文件,它具有以下內容:
#if FF_API_AVCODEC_OPEN
int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
{
return avcodec_open2(avctx, codec, NULL);
}
它導致了Expected ; after top level declarator
Expected ; after top level declarator
int attribute_align_arg avcodec_open(....
,xcode 中的錯誤(在構建期間)在這一行: int attribute_align_arg avcodec_open(....
為什么? 我該怎么做才能解決這個問題。
謝謝你。
我在使用自動完成時遇到了這個錯誤。
當插入函數的參數時,XCode 將插入需要編輯但在 GUI 中顯示為完全有效的 C++ 的占位符。
我花了幾個小時,直到我在另一個編輯器中檢查我的文件,發現而不是預期的:
void func(int a)
XCode實際上已經插入
void func(<#int a#>)
在 XCode 編輯器中,參數顯示為帶有淺藍色背景的int a
,因此不容易將其視為編譯器錯誤的來源。
對於以下代碼,我在 xcode 中遇到了類似的錯誤:
#ifndef Parser_hpp
#define Parser_hpp
#include <string>
std::string getTitle();
#endif /* Parser_hpp */
原因是代碼必須用 C++ 預處理器指令包裝。 像這樣:
#ifndef Parser_hpp
#define Parser_hpp
#if defined __cplusplus
#include <string>
std::string getTitle();
#endif /* __cplusplus */
#endif /* Parser_hpp */
在將一個類移動到動態庫但保留舊的導入后,我遇到了這個問題。 注釋掉舊的導入解決了這個問題(但這不是我尋找的第一件事,因為動態庫導入更早並且還顯示了錯誤)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.