Hello
I just dived into the world of iPhone development few days ago. I have experience with C++, C#, X-Box programming, but the iPhone is quite new for me. Had to steal my wife's MacBook pro for that matter =)
Now I have a sort of a rejection of Obj-C, as the syntax is killing me. I know I will get used to in on some time, as happened with a lot skripting languages, but for now I would just love to write my classes in C++.
I have read how to use C++ inside Obj-C, but the problem I'm having is quite annoying and I can't seam to find my way around it.
Here is what I have:
A class (let say CppClass) separated as usual into cppclass.cpp and cppclass.h
From an iPhone SDK template used to create OpenGL ES application I also have these files: EAGLView.h and EAGLView.m
Now here is the problem I'm facing. If I rename EAGLEView.m into .mm I can just go ahead and include cppclass.h without any problems and use it as usual. But what I want to do is a have a CppClass type member a part of EAGLView Obj-C class which is defined in EAGLView.h. So if I #include cppclass.h inside EAGLView.h I would get a compile error that looks like this:
"error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CppClass' "
And that error points to the line where I have my class declared like this
Code:
class CppClass{
...blah blah blah...
};
So how do I go about it? I really want to have my game logics and OpenGL stuff be in seperate
C++ classes ... at least until I'll get comfortable with Obj-C or never for the ease of porting.