0
0

Hi guys,

It would be fair to say I’m a newbie on objective-C, iPhones, etc – however, that’s not going to stop me from trying to develop something!

I have a very very basic question – which I’m hoping I can get some help on:

How do I import the FMOD libraries into my XCode project? I’ve tried doing what’s in the examples, but it’s not importing correctly. I’ve tried re-jigging the xconfig stuff, but it’s still not working.

Any help is greatly appreciated!

Steve

  • You must to post comments
0
0

There really isn’t much required to get going with FMOD on the iPhone, I will outline some things you need to do below.

  • Important (but probably not obviously for those new to Obj-C), you need to make sure your code file extension is .mm not .m, .m is for Objective-C and C code, where .mm allows Objective-C and C++ code (and hence C too). You could of course stay with the .m file and use the FMOD C interface, but the C++ interface is nicer.

  • Set your header and library search paths correct to where you have installed / copied the FMOD SDK. These are both in the "Search Paths" section of the Xcode property sheet.

  • import or #include the FMOD headers you require, either method will work.

  • Make sure you link with the correct FMOD library, there is a section in the docs (platform specific issues – iphone) that explains what each variation is used for. I have found that the best method for linking with the library is by setting the "Other Linker Flags" setting under "Linking" in the Xcode property sheet. Here you can set the debug settings as "-lfmodexL_$PLATFORM_NAME" and the release setting as "-lfmodex_$PLATFORM_NAME". This will give you FMOD logging in debug mode. The importance of $PLATFORM_NAME is it resolves to the name of the target platform, either the simulator or the device so when you change what you want to run via the main combo box it will choose the correct lib.

That should be it, you have everything you need to get started now, let me know if you (or anyone else) has any difficulties.

  • You must to post comments
0
0

Thanks for the help.

I think I’m nearly there! When I compile the project everything is ok – no issues. However, when I ‘Build and Go’, I get a whole bunch of errors from the FMOD header file:

/Developer/FMOD/api/inc/fmod.hpp:20: error: syntax error before ‘FMOD’
/Developer/FMOD/api/inc/fmod.hpp:21: error: syntax error before ‘{‘ token
/Developer/FMOD/api/inc/fmod.hpp:23: warning: type defaults to ‘int’ in declaration of ‘Sound’
/Developer/FMOD/api/inc/fmod.hpp:23: warning: data definition has no type or storage class
/Developer/FMOD/api/inc/fmod.hpp:24: error: syntax error before ‘Channel’
/Developer/FMOD/api/inc/fmod.hpp:24: warning: type defaults to ‘int’ in declaration of ‘Channel’
/Developer/FMOD/api/inc/fmod.hpp:24: warning: data definition has no type or storage class
/Developer/FMOD/api/inc/fmod.hpp:25: error: syntax error before ‘ChannelGroup’
/Developer/FMOD/api/inc/fmod.hpp:25: warning: type defaults to ‘int’ in declaration of ‘ChannelGroup’
/Developer/FMOD/api/inc/fmod.hpp:25: warning: data definition has no type or storage class
/Developer/FMOD/api/inc/fmod.hpp:26: error: syntax error before ‘SoundGroup’
etc…

I get the feeling I’m missing one last thing. The examples run OK, so this must be a configuration problem.

I believe I’ve set everything you outline below – is there anything else I can check? I’ve checked the property page side-by-side with the working example and it seems OK.

Not sure if it makes any difference but I’m running Mac OSC 10.5 – latest patch.

Thanks for your help.

All the best,

Steve

  • You must to post comments
0
0

OK – I’ve solved it myself.

For some reason I needed to change all class files to .mm, not just the one that uses FMOD. Seems to be compiling and loading now.

Thank you for your help.

Steve

  • You must to post comments
0
0

Glad you have it working.

.mm files are needed for any of your code that includes an FMOD header as well as for any of your code (not FMOD) that uses C++. The .mm file tells the compiler it needs to support C++ for that file.

You may have had a code file that includes a header, which in turn includes another header that includes FMOD. If the file in any way gets C++ code it will die unless its a .mm.

  • You must to post comments
0
0

I too have observed this issue when trying to use the C syntax. I had to rename all my .m files to .mm files (except main.m) in order to successfully build a project using the FMOD C syntax without link errors. I was getting notices about a missing "operator delete(void*)" and three missing "__cxa_guard_…" functions.

I only have a single reference of "fmod.h" anywhere within my code. And I’m using my own config information (nothing from common) which just tells it where the headers, lib are and what to link with.

Something subtle somewhere in the project or library stilll thinks there’s C++ code in there.

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.