I have a c++ class IPoint and want to use an instance of IPoint as an instance variable for an obj-c class.
But when compiling it gives me the error: “expected specifier-qualifier-list before ‘Ipoint'”
However I have included the desired header that is “IPoint.h”.
But when I use the cpp object in my class just by initializing it without making it an instance variable, it works.
There is a specific requirement of the cpp object to be stored as instance variable since it is required further in my project, if there could be a way to make it work like writing a wrapper for the object or anything else.
kindly help me out!
If you want to be able to #import your Objective-C class interface into both Objective-C and Objective-C++ code, you can use an #ifdef to declare the instance variable as void* for the former:
Unfortunately, this does mean you’ll need to manage the lifetime of the C++ object manually, creating and destroying it with new and delete in your Objective-C++ init and dealloc methods, respectively.