# Xcode integration

**URL:** <https://qa.fmod.com/t/xcode-integration/11983>\
**Category:** FMOD Studio\
**Created:** [July 10, 2015, 6:57am UTC](https://qa.fmod.com/t/xcode-integration/11983 "2015-07-10T06:57:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![uncleSax](https://avatars.discourse-cdn.com/v4/letter/u/c89c15/32.png) [@uncleSax](https://qa.fmod.com/u/uncleSax)\
**Post date:** [July 10, 2015, 6:57am UTC](https://qa.fmod.com/t/xcode-integration/11983/1 "2015-07-10T06:57:31Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [July 12, 2015, 9:45pm UTC](https://qa.fmod.com/t/xcode-integration/11983/2 "2015-07-12T21:45:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![uncleSax](https://avatars.discourse-cdn.com/v4/letter/u/c89c15/32.png) [@uncleSax](https://qa.fmod.com/u/uncleSax)\
**Post date:** [July 13, 2015, 7:43am UTC](https://qa.fmod.com/t/xcode-integration/11983/3 "2015-07-13T07:43:47Z")

</div>

> [@](#):
>
> 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.

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.

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [July 13, 2015, 9:47pm UTC](https://qa.fmod.com/t/xcode-integration/11983/4 "2015-07-13T21:47:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![uncleSax](https://avatars.discourse-cdn.com/v4/letter/u/c89c15/32.png) [@uncleSax](https://qa.fmod.com/u/uncleSax)\
**Post date:** [July 14, 2015, 8:41am UTC](https://qa.fmod.com/t/xcode-integration/11983/5 "2015-07-14T08:41:42Z")

</div>

Now I get it! thanks a lot!
