Re: Mixing C++ and Objective-C
Re: Mixing C++ and Objective-C
- Subject: Re: Mixing C++ and Objective-C
- From: Steve Wart <email@hidden>
- Date: Sat, 7 Feb 2009 13:12:02 -0800
Solved, thanks to the archives.
#ifdef __cplusplus
extern "C" {
#endif
extern CFunctionHere
#ifdef __cplusplus
}
#endif
Cheers,
Steve
On Sat, Feb 7, 2009 at 12:29 PM, Steve Wart <email@hidden> wrote:
> I am trying to build an application that uses some C++ classes, based on
> Apple's example Cocoa OpenGL application here:
> http://developer.apple.com/samplecode/CocoaGL/index.html#//apple_ref/doc/uid/DTS10004501
>
> It works fine in 10.5.6 with XCode 3.1 if I change the file type of
> BasicOpenGLView.m to sourcecode.cpp.objcpp. But if I then add the following
> to the definitions prior to the @implementation:
>
> class Vector3d {
> double x, y, z;
> };
>
> class CameraFrame {
> public:
> Vector3d origin;
> };
>
> I get a number of errors linking to the C functions in GLCheck.c. Is there
> a subtle issue I am missing or am I going about this completely the wrong
> way?
>
> Steve
>
> "HaveOpenGLCapsChanged(GLCaps*, unsigned int)", referenced from:
> getCurrentCaps() in BasicOpenGLView.o
> "initCapsTexture(GLCaps*, unsigned int)", referenced from:
> getCurrentCaps() in BasicOpenGLView.o
> "drawCaps(GLCaps*, unsigned int, long, float)", referenced from:
> -[BasicOpenGLView drawInfo] in BasicOpenGLView.o
> "CheckOpenGLCaps(unsigned int, GLCaps*, unsigned int*)", referenced from:
> getCurrentCaps() in BasicOpenGLView.o
> getCurrentCaps() in BasicOpenGLView.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
>
>
_______________________________________________
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