OS X Xcode 3.2

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.
Valaris
Posts: 8
Joined: Wed Sep 23, 2009 4:25 am

OS X Xcode 3.2

Post by Valaris »

Since the new xcode (3.2) no longer supports carbon applications apparently, is there anyway for me to be able to build an application with irrlicht using cocoa? Or what now is the preferred way of creating an application under os x, the information currently on the forum seems outdated for older versions of xcode.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

There's only one carbon function used by the OSX device, it should be simple enough to replace it for any seasoned OSX programmer (just remove the carbon framework, try to compile, find the errors, replace the function for the cocoa equivalent or remove the functionality), but I'm not one and didn't figure out what the replacement function is.
If you do work it out, please attach the changes to the carbon bug on our bug tracker
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

theres only one place in the osx code where carbon is being used, which i think bitplane said we can look at making cocoa instead (as it makes a lot more sense to use cocoa and not 1 random carbon reference)
Valaris
Posts: 8
Joined: Wed Sep 23, 2009 4:25 am

Post by Valaris »

Fair enough. The problem is I am not a seasoned os x developer. I just happen to only have a mac laptop to develop my project on when I'm not at home. That being said I create a new cocoa application (which I thought was obj c only), and add the irrlicht framework, pump in the example 1 code, and receive 1145 various errors (that seem objective c related).

I guess I'm just looking for a tutorial/sample on how I should be creating my project as a cocoa application in xcode 3.2
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

maybe post the problems, could be a number of things, bad llinks etc in the files, missing frameworks. maybe we can help
Valaris
Posts: 8
Joined: Wed Sep 23, 2009 4:25 am

Post by Valaris »

Sure thing, and thanks for the help :)

Like I said I am not familiar with OS X development. That being said in the newest xcode (3.2), I create a new cocoa application. I then add a new file, main.cpp, insert the tutorial 1 code, and add the irrlicht framework to my build target. Note - this is where I am confused because from what I have read cocoa is an objective c platform (but seems to be needed to build a proper irrlicht app? ). After that I get 1120 build errors in appkit.h (which I'm not even including anywhere).

My problem is probably trivial, I just have never build a cocoa application before.
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

ah yes i see now, the error is a simple one.

On the "Targets" in the folder, select the target you are building and press CMD+I, or right click and say get info.

Under the build tab, type "precompiled header"
There should be a bunch or so of items, look for the one that has a _pch (its a file, this file is where the build errors points to as well).

Basically the default cocoa applications have that precompiled file in there, but not set up. Take the _pch file reference out (or just delete the few lines inside that header) and it should work.

OSX / Cocoa is an objective C platform, the difference being that .m files are objective C, and .mm files are objective C++. This allows you to write 1 line ObjC, 1 line ObjC++ and it will work just fine!

This allows writing a simple application layer on top of cocoa, and integrating a full fledged c++ engines, with no problem (seeing as it supports C++ as well).
Valaris
Posts: 8
Joined: Wed Sep 23, 2009 4:25 am

Post by Valaris »

Ahh brilliant!

It is working like a charm now, and building it as a cocoa app versus a console app also fixed all my keyboard focus problems :)

The last problem I'm having is that on top of the irrlicht window popping up, the cocoa window that evidently was initially part of the project is also popping up. Now I have everything removed from the project that I can see. Is there anyway I can delete this window from my project as well?

Again thanks so much for the help :-) I'll finally be able to work on my projects when away from home now.
pedro77
Posts: 4
Joined: Sun Oct 04, 2009 9:13 pm

Post by pedro77 »

Hi all,
I don't know if this is the correct place to post my problem but the topic title is about my prob.
I've succefully built irrlicht 1.6 on Mac Snow Leopard whith XCode(well) and all the examples run correctly under the irrlicht project.

But when I try to build one of the irrlicht example into a new project, Xcode compile succefully the example but it doesn't run and I have this error into Xcode console:

Code: Select all

[Session started at 2009-10-04 23:19:18 +0200.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul  3 01:19:56 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys002
Loading program into debugger…
run
Running…
No executable file specified.
Use the "file" or "exec-file" command.
No executable file specified.
Use the "file" or "exec-file" command.
The program being debugged is not being run.
The program being debugged is not being run.

Can you help me to find out the problem?

many thanks.
ecsos
Posts: 30
Joined: Mon Feb 04, 2008 8:02 am

Post by ecsos »

the default irrlicht project doesn't include x86_64, which may be part of the problem. Change your active architecture to one that you built the irrlicht lib with to start
pedro77
Posts: 4
Joined: Sun Oct 04, 2009 9:13 pm

Post by pedro77 »

Hi ecsos,

thanks for your reply but I don't understand why irrlicht source and the examples compiled (and work) fine into xcode while if i try to complie a single example into a new project, it compile well but it doesn't run.
I've set i386 architecture into project setting and also into target properties and i've also included the frameworks required ( cocoa, carbon, opengl and iokit ) and also the libirrlicht.a .
At this point i don't know what can i do more.
mordaneous
Posts: 3
Joined: Wed Jan 27, 2010 6:35 pm

Post by mordaneous »

ah yes i see now, the error is a simple one.

On the "Targets" in the folder, select the target you are building and press CMD+I, or right click and say get info.

Under the build tab, type "precompiled header"
There should be a bunch or so of items, look for the one that has a _pch (its a file, this file is where the build errors points to as well).

Basically the default cocoa applications have that precompiled file in there, but not set up. Take the _pch file reference out (or just delete the few lines inside that header) and it should work.

OSX / Cocoa is an objective C platform, the difference being that .m files are objective C, and .mm files are objective C++. This allows you to write 1 line ObjC, 1 line ObjC++ and it will work just fine!

This allows writing a simple application layer on top of cocoa, and integrating a full fledged c++ engines, with no problem (seeing as it supports C++ as well).
Sorry, I've tried finding this under the target information, but nowhere can I find anything like _pch. Could someone point me in the right direction with this. I'm desperate to get it working on XCode!

Thanks
mordaneous
Posts: 3
Joined: Wed Jan 27, 2010 6:35 pm

Post by mordaneous »

anyone got any ideas?
joekarl
Posts: 4
Joined: Wed Mar 10, 2010 2:26 am

found it!!

Post by joekarl »

In the target information, find the prefix header and delete the value it has (should be something about appkit). also uncheck precompile prefix header.

Now you should be able to use cpp files :D

Heres an example:
http://karlkirch.com/blog/2010/03/10/bu ... xcode-3-2/
mikecurry
Posts: 5
Joined: Wed Oct 06, 2010 9:28 pm

Post by mikecurry »

mordaneous wrote:anyone got any ideas?
Your problem is simple... click 'Build and Run', than once is says running, click the "GDB" button in the bottom half of the screen to open the debugger output- it's awaiting your input!!!

[Session started at 2010-10-07 17:57:21 -0400.]
Please select the driver you want:
(a) OpenGL 1.x/2.x/3.x
(b) Direct3D 9.0c
(c) Direct3D 8.1
(d) Burning's Video
(e) Software Renderer
(f) NullDriver

Hopefully this finds you!
Post Reply