• 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
Re: Objective-C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C++


  • Subject: Re: Objective-C++
  • From: Bertrand Landry-Hétu <email@hidden>
  • Date: Thu, 8 Apr 2004 15:47:43 -0700

Rename MyController.m to MyController.mm

gcc needs the .mm extension to guess that your file is objective-c++ code.

On 08 avr. 2004, at 15:14, David Piasecki wrote:

I'm trying to mix Objective-C with existing C++ files, but I'm having
some trouble getting XCode to compile the C++ source. I have a simple
object called TestCC that has an Add() method. When I #import TestCC.h
into MyController, it gives me the errors below.

TestCC.h:10: error: parse error before "TestCC"
TestCC.h:10: cannot find interface declaration for `MapController'
TestCC.h:11: error: syntax error before '{' token
TestCC.h:16: error: parse error before ':' token

Source...

// TestCC.h
class TestCC {
public:
TestCC();
int Add( int a, int b );

private:
};
---------------------------------------
// TestCC.cpp
#include "TestCC.h"

TestCC::TestCC() { }

int TestCC::Add( int a, int b ) {
return a + b;
}
---------------------------------------
// MyController.m
#import "TestCC.h"
@implementation MyController

- (IBAction)MyButtonClicked:(id)sender{ }
-----------------------------------------------------------
// MyController.h
#import <Cocoa/Cocoa.h>
@interface MyController : NSObject {
}
- (IBAction)MyButtonClicked:(id)sender;
@end


I've read what I could find online, and this seems to be the way to do
it, but XCode's not agreeing with me.

David
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Creo
Bertrand Landry-Hitu | Software Developer | tel: +1 604.451.2700 x5967 |
email@hidden | www.creo.com

IMAGINE CREATE BELIEVE(tm)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Objective-C++
      • From: "David Piasecki" <email@hidden>
References: 
 >Re: Objective-C++ (From: "David Piasecki" <email@hidden>)

  • Prev by Date: Re: setNeedsDisplay: thread safe?
  • Next by Date: Re: setNeedsDisplay: thread safe?
  • Previous by thread: Re: Objective-C++
  • Next by thread: Re: Objective-C++
  • Index(es):
    • Date
    • Thread