I picked this up from an answer to a question on how to call objective-c method from C++ method
This runs fine.
MyObject-C-Interface.h
#ifndef __MYOBJECT_C_INTERFACE_H__
#define __MYOBJECT_C_INTERFACE_H__ 1
int MyObjectDoSomethingWith (void *myObjectInstance, void *parameter);
#endif
MyObject.h
#import "MyObject-C-Interface.h"
@interface MyObject : NSObject
{
int someVar;
}
- (int) doSomethingWith:(void *) aParameter;
@end
MyObject.mm
#import "MyObject.h"
@implementation MyObject
int MyObjectDoSomethingWith (void *self, void *aParameter)
{
return [(id) self doSomethingWith:aParameter];
}
- (int) doSomethingWith:(void *) aParameter
{
// ... some code
return 1;
}
@end
MyCPPClass.cpp
#include "MyCPPClass.h"
#include "MyObject-C-Interface.h"
int MyCPPClass::someMethod (void *objectiveCObject, void *aParameter)
{
return MyObjectDoSomethingWith (objectiveCObject, aParameter);
}
NOW if i use something like
MyObject-C-Interface.h
#ifndef __MYOBJECT_C_INTERFACE_H__
#define __MYOBJECT_C_INTERFACE_H__ 1
@class MyObject;
int MyObjectDoSomethingWith (MyObject* myObjectInstance, void *parameter);
#endif
My question is instead of using void *myObjectInstance if i use MyObject *myObjectInstance.
it gives this error
error: expected unqualified-id [1] : @class line and
error: use of undeclared identifier 'MyObject' [3] in function prototype's line
Help!!!!