Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

AppFusion - 6 in 1!
($0.99)

Want your application or service advertised on iPhone Dev SDK?

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

Reply
 
LinkBack Thread Tools Display Modes
Old 11-19-2008, 02:27 PM   #1 (permalink)
Registered Member
 
chuck's Avatar
 
Join Date: Aug 2008
Location: Berlin, Germany
Posts: 87
Default porting C++ to iPhone

In the next few weeks I'd like to port a game using the SDL library to the iPhone. Have any of you successfully ported any C++ code to the iPhone. I believe you can link the code somehow. Can anyone give me a hint as to where I should start? Does anyone know of any examples of this anywhere? Any help would be greatly appreciated.
__________________
German Course: Learn German anywhere! Chess Player: Study Chess anywhere!
chuck is offline   Reply With Quote
Old 11-19-2008, 04:44 PM   #2 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 802
Default

Check the Apple developer site. C++ files need to have .mm to make things cleaner.
all the UI access on the phone is through Objective-C so you will have to deal with it and interface to it.
scottiphone is offline   Reply With Quote
Old 11-20-2008, 02:47 AM   #3 (permalink)
Registered Member
 
Join Date: Oct 2008
Posts: 99
Default

Yes, it's doable. I've done this, ported stuff that uses SDL (check out skyrails, I used that things' graphics lib), and c++ works pretty flawlessly.

OpenGL ES has a few quirks which make it different, and porting texture loaders from CrashLanding app takes a while though. CrashLanding app's sound library is actually writtein in c++, you should take a look at that.

All you need to get c++ working is just change the file type into objcpp, once you got the file in xcode. Don't even have to rename it to .mm or whatever.
underthesun is offline   Reply With Quote
Old 11-21-2008, 12:56 AM   #4 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 18
Default

I've port too. It's easy to port C++ code to iPhone. you can keep your old code file, those .cpp, .h, in your iPhone project.
rick is offline   Reply With Quote
Old 12-11-2008, 12:06 PM   #5 (permalink)
New Member
 
Join Date: Dec 2008
Posts: 1
Default

If i want to port a huge unix c/c++ library to Iphone, how can I do?
Have I to put all the cpp files of the library into my iphone project?
seldon is offline   Reply With Quote
Old 12-11-2008, 12:17 PM   #6 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 812
Default

C++ files should still be .cpp. Objective-C++ should be .mm
johnqh 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



» Advertisements
» Online Users: 654
25 members and 629 guests
ADY, BrianSlick, cotzy, Creativ, dacapo, Dattee, e2applets, gbenna, IphoneSdk, iseff, jakerocheleau, Jamarsoft, jbro, JiDai, kampftrinker, linkmx, mashercakes, nimesh_158, PikPok, Reyna, touchcream, ukneeq, yurikus
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 160,619
Threads: 89,833
Posts: 383,488
Top Poster: BrianSlick (7,243)
Welcome to our newest member, yurikus
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:37 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0