Question on Programming for MacOSX

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
bluecat
Posts: 17
Joined: Tue Sep 22, 2009 10:29 pm

Question on Programming for MacOSX

Post by bluecat »

Hi,

I started a project in XCode 3.2 and got Irrlicht 1.7.1 to work, thanks!
But in my project, I have to name all files with the extension .mm

How did you get XCode to accept .cpp files to compile C++ instead of Objective-C in the Irrlicht XCode project?
I already studied the project settings and googled, but found no solution. Since I want to share the code later for cross platform development, the .mm extension is not quite useable...

Can someone please help me?
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

.m = Objective C code only
.mm = Objective C++ (Objc and C++ can be used together)
.cpp/cc = C++ code,

You can code as much c++ as you want to, and the compiler will know what to do with the file based on the extension. If you :Get Info: on the specific file, there is a build rules tab which can be used to override the option, but

It should work as is. How are you adding the files to the target/project. Make sure that when you add it, you make them part of the target you are building,

Search for the file in the top right area of XCode, and then make sure it has a little tick in the target column (it looks like a target).
bluecat
Posts: 17
Joined: Tue Sep 22, 2009 10:29 pm

Post by bluecat »

Hmm, thanks for the input FuzzYspo0N.

I checked this and the .cpp file info is sourcecode.cpp.cpp
The file is also part of the build target, but if I try to compile it, I get 1120 compiler errors (!) in NSObjCRuntime.h with symbols undefined, etc.

Strange thing is, this happens as soon as i put any .cpp file to my project, even an empty one. If i name the file to .mm or exclude it from build, it works.

Sure, i could live with .mm files but I'd like to understand that. Maybe can help me there? :?:
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

Check for prefix / precompiled headers. If its using those (app_Prefix.pch), it often can bomb out on the objective C side.
bluecat
Posts: 17
Joined: Tue Sep 22, 2009 10:29 pm

Post by bluecat »

I checked for prefix settings, but they don't differ from those in Irrlicht's MacOSX project settings. There is also a MacOSX_Prefix.pch...

I also tried to change some of the settings and did "clean build" and "build" again, but only got more error messages (up to over 10.000 ) :D

Well, next I'll try to get IrrODE to work on MacOSX. Maybe I get more insights then...
bluecat
Posts: 17
Joined: Tue Sep 22, 2009 10:29 pm

Post by bluecat »

Ahhh, I found the solution in another Irrlicht thread :D

I didn't get what you meant with the prefix headers, but now I understand.
The apple default project settings include an Appkit.h precompiled prefix header and this must be disabled in the project settings!

Here is the link I found with the vital information:
http://karlkirch.com/blog/2010/03/10/bu ... xcode-3-2/

Thanks for the help, maybe I can make some progress on IrrODE on MacOSX now...
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

Cool, my post was a little vague but thats what i meant, those headers are usually not used unless a) you know what they are for and b) you set them up first. The defaults tend to break things.

Glad you got it working.
Post Reply