You can now already test if everything works by selecting “Product Build” (Cmd B).In the Project Navigator, you will find your library in the “Products” group. You will find your compiled library and the headers in the “include” folder.You will notice that the “include” folder also contains the C source files in its subfolders, because XCode stupidly also copies them in the “Copy headers” build phase. So we will need to run a clean up script afterwards.Go to the “Build Phases” view again and select “Editor This will recursively delete all .c-files in the header file output path.Drag & drop these elements to the Project Navigator tab.Now when XCode asks to add the elements to your project you must select “Create folder references”. This will create two blue folders which contain your source code.But with some tricks it is still possible to get XCode to export your original header directory structure.It requires some manual work, though, and you might wonder how on earth this simple matter could be so complicated in XCode.
This will create a yellow folder icon in this view.
Here, another strange XCode behaviour will strain our nerves: It is not possible to add the source code files with the “ ” symbol when they are in those blue “folder references”.
You will need to drag & drop them from the Project Navigator on the left side.
Now in OSX Finder, go to your C source code root directory – I’ll also name it “src”.
Suppose you have a file in your source code root directory.