Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-01-2009, 01:43 AM   #1 (permalink)
New Member
 
Join Date: Jul 2009
Posts: 3
Default Confused about C++ classes inside Obj-C

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.
dsedov is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 23,994
Threads: 38,776
Posts: 170,152
Top Poster: smasher (2,560)
Welcome to our newest member, wionj
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:57 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0