• 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: "David Piasecki" <email@hidden>
  • Date: Thu, 8 Apr 2004 15:14:08 -0700

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.


  • Follow-Ups:
    • Re: Objective-C++
      • From: Brian Bergstrand <email@hidden>
    • Re: Objective-C++
      • From: Bertrand Landry-Hétu <email@hidden>
  • Prev by Date: Best way to obtain the width of a piece of text?
  • Next by Date: Re: setNeedsDisplay: thread safe?
  • Previous by thread: Re: Best way to obtain the width of a piece of text?
  • Next by thread: Re: Objective-C++
  • Index(es):
    • Date
    • Thread