Objective-C++: compiling C++ class in a Cocoa app
Objective-C++: compiling C++ class in a Cocoa app
- Subject: Objective-C++: compiling C++ class in a Cocoa app
- From: Nicola Vitacolonna <email@hidden>
- Date: Fri, 14 Jun 2002 10:12:25 +0200
I have created a Cocoa app in PB, and I have added a .mm file (along
with its header .h) containing the definition of a C++ class (a minimal
example is below). I also added libstdc++.a to the project. But when I
compile, I get an "undefined type, found 'class'" error (plus a lot of
other errors). My impression is that the compiler does not realize that
a .mm file is a C++ file. Any hint?
The file Foo.h looks like this:
class Foo
{
public:
Foo();
~Foo();
void doNothing();
};
The file Foo.mm is as follows:
#import "Foo.h"
Foo::Foo() {
}
Foo::~Foo(){
}
Foo:doNothing() {
}
There is an action connected to a button, which should invoke a method
in Foo. Something like that:
#import "Foo.h"
- (IBAction)myAction:(id)sender {
foo = new Foo;
foo->doNothing();
delete foo;
}
Nicola Vitacolonna
_______________________________________________
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.