“Cannot find interface declaration for NSObject”?

前端 未结 7 579
礼貌的吻别
礼貌的吻别 2020-12-15 08:09

So I\'ve done some research into this issue, but I haven\'t found anything similar just yet...

So I\'m coding a game in Obj-C using Xcode and Sparrow Framework. I\'v

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-15 09:03

    Also make sure you're not including an Objective-C file from a .cpp or .c file.

    Example: a PhotoManager.mm might include the header file from the Objective-C pair PhotoObject.h/PhotoObject.mm. Then, if MyAwesomeCppFile.cpp includes PhotoManager.h, suddenly PhotoObject.h doesn't know the basic Objective-C classes and keywords.

    A solution would be to use #ifdef __OBJC__ if you can get away with it.

    Otherwise designate the .cpp file type as Objective-C++ Source in the file's properties panel (Top right window control => "Identity and type")

提交回复
热议问题