Re: Mixing ObjC and C++ STL on same ObjC source file
Re: Mixing ObjC and C++ STL on same ObjC source file
- Subject: Re: Mixing ObjC and C++ STL on same ObjC source file
- From: email@hidden
- Date: Fri, 12 Sep 2008 10:29:43 +0200
On 12 Sep 2008, at 10:17, Daniel Luis dos Santos wrote:
Hello !
I have an objective C class and want to call a method on a class in C
++. As argument to the C++ class is a map instance of the STL.
The ObjC class definition is on a file with a mm extension.
I have std::map *var as a member variable of the ObjC class. When I
compile the code there is an error saying :
/Users/dlsa/code/Finema/trunk/LiquidSurfaces/src/CVDisplayPipeline.h:
20: error: using-declaration for non-member at class scope
How do I do this ?
_______________________________________________
Does this happen when you compile CVDisplayPipeline.mm, or when you
compile another file which might only be a .m file? If it is the
latter, then that would be your problem since you are no longer
compiling Obj-C++.
If it is in CVDisplayPipeline.mm then It could just be that you aren't
including the right header file in CVDisplayPipeline.h (<map> I think).
If you do have to include your .h file in other .m files, you can
workaround the problem of having pointers to C++ classes like so:
#if defined(__cplusplus)
#include <map>
typedef std::map* std_mapPtr;
#else
typedef void* std_mapPtr;
#endif
@interface MyClass: NSObject
{
std_mapPtr mMap;
}
-(std_mapPtr) map;
-(void) setMap: (std_mapPtr) aMap;
@end;
Matt
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden