First, I took both /spine-cocos2d-iphone and /spine-c folders and copied them into my project directory.
Why did you do this? You should just build Spine library and use it in your project, easy and clear 🙂.
(What's wrong? Why is there the "spine/" prefix in all the includes? Should the physical folder structure or the XCode project structure contain Spine runtime files in this subfolder?)
It's a problem because you use Spine as internal file, a "clear" technique is to use (again) Spine has an external library.
Here is an exemple to show you how I do:
1- First, It's just my preference but I like to work with an architecture like that:
Loading Image
-
use "data" to put assets (sounds, musics, Spine skeleton, json files, …)
-
use "src" to put all your ".m" and ".c" files
-
use "inc" to put all yout ".h/.hpp" files.
-
finally, use extlibs to put external libraries like Spine, Cocos. "bin" folder stock binary files and "header" folder is use to put external library's headers files (So, put here "spine" folder from "include" folder from the Spine C runtime)
Here, you should have something like what is show in my previous picture.
2- Configure, Xcode.
Now, we need to say to Xcode to search in the right folders:
Loading Image
Change "Header Search Paths" to your headers paths, basically :
3- Configure your project.
Finally, everything is ok but you need to change "include" lines.
// Before
#include "main.h"
// After
#include <main.h>
The advantage of this technique is every "include" in your project come from your project "inc" folder, you didn't have to do include like that:
// "Normal way"
#include "../../characters/spineboy.h"
// Now
#include <characters/spineboy.h>
So, when you need to use Spine runtime or Cocos library, you just have to include it like that
#include <spine/something.h>
// or
#include <cocos2D/something.h>
4- One more thing.
Don't forget to drag and drop the "extlibs/bin" folder to your Xcode project to include binary files (or say to Xcode to search in this folder with "Library Search Path" configurationline)
Good luck 😉