Mixing Objective-C and C++

后端 未结 5 1907
粉色の甜心
粉色の甜心 2020-11-29 01:54

I\'m trying to mix Objective-C with C++. When I compile the code, I get several errors.

A.h

#import 
#include \"B.h\"

@interfac         


        
5条回答
  •  醉梦人生
    2020-11-29 02:17

    you could keep the interface cleaner with forward declaration of C++ classes:

    #import 
    class DBManager; // This is a C++ class. NOTE: not @class
    
    @interface AppDelegate : UIResponder 
    {
        DBManager* db;
    ...
    }
    

提交回复
热议问题