• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Mixing C++ and Objective-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mixing C++ and Objective-C


  • Subject: Mixing C++ and Objective-C
  • From: Steve Wart <email@hidden>
  • Date: Sat, 7 Feb 2009 12:29:25 -0800

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

  • Follow-Ups:
    • Re: Mixing C++ and Objective-C
      • From: Peter N Lewis <email@hidden>
    • Re: Mixing C++ and Objective-C
      • From: Steve Wart <email@hidden>
  • Prev by Date: Re: NSButton referencing outlet won't work?
  • Next by Date: Re: NSTableView Popup Column issue
  • Previous by thread: Re: NSButton referencing outlet won't work?
  • Next by thread: Re: Mixing C++ and Objective-C
  • Index(es):
    • Date
    • Thread