0
0

I was easily able to compile and run the sample code. But when I add the following to my code:

import "fmod.hpp"

the compile fails. I get the following error:

Expected ‘=’,’,’,’;’,’asm’ or ‘attribute‘ before ‘FMOD’

This is at line 20 of fmod.hpp. The line reads:

namespace FMOD

I’m still a little new to Xcode but I think that there’s something wrong with the configuration of my target. I compared what I have with the sample code and thought I match everything up. However, there are numerous options that aren’t available in my drop down. Is there any documentation that explains how to create the project?

  • You must to post comments
0
0

Does your code file have the extension ".mm"? If it is only ".m" then you will get errors when the compiler encounters C++ code. ".m" is for C and ObjC, ".mm" is for C++, C and ObjC which you require if including fmod.hpp.

  • You must to post comments
0
0

Thanks. I didn’t know that. Makes sense. I’ll check that out later.

  • You must to post comments
0
0

That was it. Got my program running. Thanks.

  • You must to post comments
0
0

What about if the import is within a .h file? I can get it to compile within the .mm for the .h, but i cannot declare properties to interface from the .mm. Any ideas? Does that even make sense?

  • You must to post comments
0
0

Header files are not compiled, only code files such as .c and .cpp (or in this case .m and .mm files) are compiled. What the compiler does is it interprets the #include (or in this case #import) preprocessor directive by inserting the entire header into the code file at that point. The result of the preprocessor is a big blob of code (made up of one code file and any number of headers) and is known as a [url=http://en.wikipedia.org/wiki/Translation_unit_%28programming%29:2dx6e86p]translation unit[/url:2dx6e86p] and that whole thing is compiled as one.

So with regard to your question of whether you can include C++ code in a header, you can if that header is [i:2dx6e86p]only[/i:2dx6e86p] imported by files with the .mm extension.

  • You must to post comments
0
0

Thanks Peter. That was definitely an issue i ran into later, but the source my problem was more complex than that. I went through a lot of trial and error get to the working Xcode 4.2 setup, but finally cracked it. I also wrote a blog post about it and though i would post it here for posterity.

http://www.zen-sign.com/adding-fmod-ios … xcode-4-2/

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.