Some problems during manually create Ogre project on XCode

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
magengyu
Kobold
Posts: 35
Joined: Sat Jul 28, 2012 7:54 am

Some problems during manually create Ogre project on XCode

Post by magengyu » Sat Jul 28, 2012 9:46 am

I have succesfully build the samplebrowser and run ogre template sample on iphone simulator thanks to many useful articles here.
my system is: Ogre 1.8, Lion 10.7.4, XCode 4.3.1

Right now, I want to add ogre to my project. but met some problems.
To start, I create an empty project and add "OgreFramework.h & .cpp" "OgreDemoApp.h & .cpp" and "AppDelegate.h" from another template project.
Then I add header and library search directory and compile the project.

The first problems is:
When build the project, 3 error occures
the first is: "error: unknown type name namespace" in OgrePlatform.h;
I googled a solution is to " set 'compile source as' setting from 'According to file type' to 'Objective-C++' ". The errors are gone.
But I checked the ogre template project, this setting is not changed, still is 'According to file type'.
So I'm wondering why the template can work fine without changing this setting.

My second problem is about sandbox on the iphone simulator.
I just drag-drop the media directory from tempate to my project.
in the XCode Navigator window, the directory structure in fine. but in the sandbox, there is no 'media' directory, and all the files such as 'SDKTrays.zip', 'ogre.cfg', are all in the root directory.
If I modify the resources.cfg file by deleting the 'media/pack/' part, the program can run succesfully.
But I think I must did something wrong in adding files to sandbox.

I know these problems are more related with XCode programming than Ogre SDK. but I thought maybe some other beginners like me may met same problems later, and hope your answer can be helpful to them too.

I also want to share another problem that confused me for several days.
If I drag and drop source codes to a project and did not check the 'Add to Project' option (which is unchecked by default). The file is still added to the project. but when building, 4 linking errors will occure. such as: "Undefined symbols 'DemoApp::startDemo()'". If add files from the menu, every thing is fine.
0 x

User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!

Re: Some problems during manually create Ogre project on XCo

Post by Brocan » Sat Jul 28, 2012 7:56 pm

Regarding the first problem, make sure that the Objective-C file where you make use of ogre (for example a view controller for the main view, or the app delegate) has a ".mm" extension. If your file uses original ".m" extension, only Obj-C compiler is used, if you name it with ".mm" the C++ compiler is also used.

About your second problem, i don't known why its happening, normally drag-drop the folder from finder to xcode is enough to maintain the same structure in your app.

BTW, i'm very far to be an expert in ios programming, so i'm sure that other people could solve your problems much better than me :mrgreen:
0 x

magengyu
Kobold
Posts: 35
Joined: Sat Jul 28, 2012 7:54 am

Re: Some problems during manually create Ogre project on XCo

Post by magengyu » Sun Jul 29, 2012 6:52 am

Thanks. problem solved.

In face, since I only added .h and .cpp files. I did not remember the .mm issue. When I check again, I rename main.m to main.mm, then it works well.
0 x

Post Reply