Xcode integration

Hy everybody, I’m having some problems linking the libraries of fmod into xcode.

I’ve set all the header search paths and also linked the libraries (I’ve tried to link them both in build phase and in the other linked libraries) but I still have some linkage problem.
Sometimes it doesn’t see the common_init method, other times it can’t properly link the libraries.

I’ve took a look at the example and tried to replicate the settings, but without any luck.
Am I missing something? Is there a small guide that I can follow?

Thanks a lot!

[UPDATE]

I’ve found that I was linking everything properly but my problem is located into the _main symbol.

I’m trying to put Fmod studio API into the cube 2 engine, but the SDL_mixer of the engine has an external method linked to the main function (which I think reside into its lib).
At the same time FMOD needs the FMOD_Main() function (if I understood well).

So everytime I try to implement somehow the FMOD_Main() function I get the following error.

duplicate symbol _main in:
/Users/Sam/Library/Developer/Xcode/DerivedData/sauerbraten-czltvyxmalcabybpqxqrbeggiiqy/Build/Intermediates/sauerbraten.build/Debug/sauerbraten.build/Objects-normal/x86_64/main-3ABFC5E42590546D.o
/Users/Sam/Library/Developer/Xcode/DerivedData/sauerbraten-czltvyxmalcabybpqxqrbeggiiqy/Build/Intermediates/sauerbraten.build/Debug/sauerbraten.build/Objects-normal/x86_64/common_platform.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

How can I deal with that?

thanks a lot!

You don’t need FMOD_Main, or any function with the Common prefix.
These are simply for our example framework that make it simpler to demonstrate FMOD.

Just put the FMOD initialization code that starts with creating the FMOD::System wherever your other initialization code is.

2 Likes

So I don’t need the common.h header and those lines of code related to the extraDriver data?
Because I’ve found that the second main symbol is located into the file common_platform.mm. Giving this to the precompile raise the error.
If i link the FMOD_Main function called into the main thread to another name (example #define FMOD_Main start_fmod) and I change the main symbol to start_fmod, everything goes fine.

Not in your own project no, common.h and common_platform.h are for our ‘common framework’ to simply to make our demos crossplatform. You would have you own game engine or platform code to handle these things.

Now I get it! thanks a lot!