我想實現我的Xcode項目中C++類,但我發現了以下錯誤:Xcode中:C++錯誤:未知類型名稱「類」做你的意思是「類」
Expected ';' after top level declarator
Unknown type name 'class'; did you mean 'Class'
#ifndef DoingSomething_hpp
#define DoingSomething_hpp
#include <stdio.h>
class DoingSomething {
public:
static DoingSomething *instance();
int doSomething();
};
#endif /* DoingSomething_hpp */
但添加DoingSomething.hpp到我的viewController後,錯誤開始顯示:
#import "ViewController.h"
#import "DoingSomething.hpp"
@interface ViewController()
任何人都知道爲什麼這個錯誤,或者我該如何解決或者如果有解決方法?
我真的很感謝你的幫助。
您的視圖控制器是一個Objective-C++文件嗎? – dan
@dan,我的viewController是Objective-C文件 – user2924482