# Mac Xcode

> ProudNet iOS version
>
> * Development languages: C/C++
> * Library and Sample: XCode8 Version

***

## 1.  Preparation Work

Below shows how to include ProudNet Library in your XCode Project.

1-1. Copy the files below to your Mac

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/irxYb5XCqysozgLitqh8/copy_mac.png" alt=""><figcaption><p>Copied files and paths</p></figcaption></figure>

> * ProudNet\Sample\Chat\ChatCommon
> * ProudNet\Sample\Chat\ChatIOS
> * ProudNet\lib\IOS\LLVM(or GNU)
> * ProudNetProudNet\utill\PIDL.exe

1-2. Install Mono for Mac.

{% hint style="success" %}
**Reference**

[**Install Mono for Mac**](https://www.mono-project.com/docs/getting-started/install/mac/)
{% endhint %}

1-3. open <mark style="color:orange;">ChatIOS.xcodeproj</mark> in <mark style="color:orange;">Sample\ChatIOS</mark>&#x20;

1-4. Add <mark style="color:orange;">Include.xcodeproj</mark> to your project.

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/UChGIwo0BfMwD3Y2ySNS/include_xcodeproj.png" alt=""><figcaption></figcaption></figure>

1-5. Modify the contents of the Run Script for <mark style="color:orange;">BuildPhases</mark>.

1-6. Modify Debug, Relese in <mark style="color:orange;">Build Settings > Other Linker Flags</mark>.

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/VQPcJsDiMDASc1DWPu3i/xcode3.png" alt=""><figcaption></figcaption></figure>

Change to the path where the actual <mark style="color:orange;">libProudNetClient.a</mark> is located, and choose between LLVM and GNU. If you have a directory structure like the one above, it should look like the screenshot.

1-7. To check, after building ChatIOS, you can run ChatServer on Windows to check for ChatIOS connectivity.

{% hint style="danger" %}
**Notes on using ProudNet in Xcode**\
※  Add <mark style="color:orange;">libiconv.dylib</mark>, a library built in Xcode.\
※ It is not available in m-files, so you need to change the extension to mm-files.\
※ Add <mark style="color:orange;">#include \<new></mark> to all mm files. In Xcode, STLs cannot be declared in header files.
{% endhint %}

## 2. Resolving errors

### - Link error when adding ProudNet Library

If you experience a link error when adding the ProudNet Library, add the following option.

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/fFMdKn5R23dAh5DMfvqX/xcode1.png" alt=""><figcaption></figcaption></figure>

### - Link error with duplicate symbol when using the <mark style="color:orange;">-all\_load -Objc</mark> option

If <mark style="color:orange;">COCOs2d-x</mark>, a link error related to duplicate symbol, occurs when using the <mark style="color:orange;">-all\_load -Objc</mark> option, use <mark style="color:orange;">-force\_load</mark> instead of <mark style="color:orange;">-all\_load -Objc</mark> in <mark style="color:orange;">Other Linker Flags</mark>.

<figure><img src="https://content.gitbook.com/content/Ceg6wWD81CFYby05yPX5/blobs/SmbrEDXENWLNHWtpRXh6/xcode2.png" alt=""><figcaption><p>Example of using the -force_load option</p></figcaption></figure>

To match the path, adjust the path to <mark style="color:orange;">PIDL.exe</mark>. If the directory structure is as above, please modify it as follows. <mark style="color:orange;">mono ../../util/PIDL.exe ../ChatCommon/\* -outdir ./ChatIOS/</mark>

***

## :arrow\_left: [<mark style="color:blue;">Back</mark>](https://docs.proudnet.com/proudnet.eng/proudnet/2.setting/..#id-1.-set-up-your-project)
