Re: Objective-C++
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.