UselessRob
2005.04.07, 01:49 AM
Howdy
I've started fiddling with some Mac OSX programming after getting bored with Windows, but there's something that I can work out (actually lots of things, but this one's stopping me going further for now):
How do I use a normal C++ class variable in one of the main NSView class thingys?
It seems in a .m file (objective-c) it will always complain about the class being defined in an #include'd file. If it's a .mm file, it compiles fine, but then I get a single error that makes no sense. It simply says "Undefined Symbols:" without actually saying what symbols are undefined. Obviously, simply renaming the file to .mm isn't the way to go. :) But I can't find any of the files I can add to xcode, or any of the projects you start with, that let you start with a .mm file anyway.
So question is, how do I use C++ classes in a view class. I'm starting by trying to do a screensaver. So I've started a Screen Saver project, no worries there. But I'm using code I've written in c++ for the drawing and all that, so I need to have a variable of that class in the view class.
If it makes any diff, I'm using OpenGL for drawing stuff, but I'm pretty sure all the foundations I need are included, so I don't understand the empty "Undefined symbols:" message when I actually get it to compile. Help!
I hope this makes sense to someone, and I apologise for being clueless!
Rob.
I've started fiddling with some Mac OSX programming after getting bored with Windows, but there's something that I can work out (actually lots of things, but this one's stopping me going further for now):
How do I use a normal C++ class variable in one of the main NSView class thingys?
It seems in a .m file (objective-c) it will always complain about the class being defined in an #include'd file. If it's a .mm file, it compiles fine, but then I get a single error that makes no sense. It simply says "Undefined Symbols:" without actually saying what symbols are undefined. Obviously, simply renaming the file to .mm isn't the way to go. :) But I can't find any of the files I can add to xcode, or any of the projects you start with, that let you start with a .mm file anyway.
So question is, how do I use C++ classes in a view class. I'm starting by trying to do a screensaver. So I've started a Screen Saver project, no worries there. But I'm using code I've written in c++ for the drawing and all that, so I need to have a variable of that class in the view class.
If it makes any diff, I'm using OpenGL for drawing stuff, but I'm pretty sure all the foundations I need are included, so I don't understand the empty "Undefined symbols:" message when I actually get it to compile. Help!
I hope this makes sense to someone, and I apologise for being clueless!
Rob.