Welcome, Guest. Please login or register.

Login with username, password and session length
Welcome to our new forum!
 
Pages: [1]   Go Down
  Reply  |  Send this topic  |  Print  
Author Topic: Mixing C++ and Objective-C code for iPhone apps  (Read 786 times)
0 Members and 1 Guest are viewing this topic.
jedimasterjsa
Forum Master
Administrator
Unreleased
*****
Offline Offline

Posts: 186


Proud Star Wars and Mac geek.


PencilBusters PencilBusters
View Profile WWW
« on: December 09, 2009, 08:16:52 PM »
Reply with quoteQuote

This was something that caused a lot of headache for one of our apps.  I downloaded this open source engine to help with the physics of our game, but it was pretty much all written in c++.  All the c++ source files themselves would compile just fine, but when I tried to #import the headers files into my Objective-C project, I got about 1300 errors!  So, I went on a massive Google search to figure out what was wrong.  I was pretty sure it had to do with the c++ syntax in the header files.  After a long and exhaustive search, I finally came up with the answer.  I kept reading that in order to use c++ code in an Obj-C file, the file extension needed to be .mm, but none of my files actually had c++ in them.  Then I came across a vague reference to the fact that even those files that just import c++ files need to have the .mm extension.  So I tried it, and it worked!  Needless to say, this simple solution made me feel like a complete idiot.  But now I know, that in order to use c++ files, any Obj-C files that import the c++ header files NEED to have that stupid .mm extension!  Anyways, I hope other people can avoid the same frustration I felt over this stupid predicament.
Report to moderator   Logged

Co-Founder of Pencil Busters, Inc - PBI Homepage;
PBI Forum Admin - PBI Forum;

Life's just not fun without a little geekiness!
Pages: [1]   Go Up
  Reply  |  Send this topic  |  Print  
 
Jump to:  




Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC
Enterprise design by Bloc