I’m using an external library (Namely : Spine runtime) and I have it’s source (.h/.c/.cpp files) in my class folder. I have no trouble using it on Android, but I have a linker error on Linux.
Here is my Linux Makefile :
``` EXECUTABLE = WallieINCLUDES = -I… -I…/Classes
-I…/Classes/spine
-I…/Classes/spine-c/includeSOURCES = main.cpp
…/Classes/AppDelegate.cpp
…/Classes/WallLayer.cpp
$(wildcard …/Classes/spine-c/scr/spine/.c)
$(wildcard …/Classes/spine/.cpp)
#…/Classes/spine/*.cpp
#…/Classes/gamescreen.cpp
#…/Classes/ext/pugixml/pugixml.cpp#STATICLIBS +=
#$(LIB_DIR)/libextension.a
#$(LIB_DIR)/libbox2d.aCOCOS_ROOT = …/…/…
include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mkSHAREDLIBS += -lcocos2d #-lbox2d
COCOS_LIBS = $(LIB_DIR)/libcocos2d.so$(TARGET): $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(LOG_LINK)$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)$(OBJ_DIR)/%.o: %.cpp $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(LOG_CXX)$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@$(OBJ_DIR)/%.o: …/%.cpp $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(LOG_CXX)$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@</blockquote> And here is the out put for `Make run` : <blockquote>
LINK bin/release/Wallie
obj/release/Classes/WallLayer.o: In functionWallLayer::isInterruptible()': WallLayer.cpp:(.text+0x3ee): undefined reference to
spAnimationState_getCurrent’
obj/release/Classes/WallLayer.o: In functionWallLayer::animationStateEvent(spine::CCSkeletonAnimation*, int, spEventType, spEvent*, int)': WallLayer.cpp:(.text+0x7af): undefined reference to
spAnimationState_getCurrent’
obj/release/Classes/spine/CCSkeletonAnimation.o: In functionspine::CCSkeletonAnimation::~CCSkeletonAnimation()': CCSkeletonAnimation.cpp:(.text+0xb6): undefined reference to
spAnimationStateData_dispose’
CCSkeletonAnimation.cpp:(.text+0xc2): undefined reference tospAnimationState_dispose' obj/release/Classes/spine/CCSkeletonAnimation.o: In function
spine::CCSkeletonAnimation::initialize()’:
CCSkeletonAnimation.cpp:(.text+0x147): undefined reference tospAnimationStateData_create' CCSkeletonAnimation.cpp:(.text+0x14f): undefined reference to
spAnimationState_create’
obj/release/Classes/spine/CCSkeletonAnimation.o: In functionspine::CCSkeletonAnimation::setAnimationStateData(spAnimationStateData*)': CCSkeletonAnimation.cpp:(.text+0x3c0): undefined reference to
spAnimationStateData_dispose’
CCSkeletonAnimation.cpp:(.text+0x3cc): undefined reference tospAnimationState_dispose' CCSkeletonAnimation.cpp:(.text+0x3db): undefined reference to
spAnimationState_create’
obj/release/Classes/spine/CCSkeletonAnimation.o: In functionspine::CCSkeletonAnimation::setAnimation(int, char const*, bool)': CCSkeletonAnimation.cpp:(.text+0x454): undefined reference to
spSkeletonData_findAnimation’
obj/release/Classes/spine/CCSkeletonAnimation.o: In functionspine::CCSkeletonAnimation::addAnimation(int, char const*, bool, float)': CCSkeletonAnimation.cpp:(.text+0x4ca): undefined reference to
spSkeletonData_findAnimation’
obj/release/Classes/spine/CCSkeletonAnimation.o: In functionspine::CCSkeletonAnimation::update(float)': CCSkeletonAnimation.cpp:(.text+0x580): undefined reference to
spAnimationState_update’
CCSkeletonAnimation.cpp:(.text+0x593): undefined reference tospAnimationState_apply' obj/release/Classes/spine/CCSkeletonAnimation.o: In function
spine::CCSkeletonAnimation::setMix(char const*, char const*, float)’:
CCSkeletonAnimation.cpp:(.text+0x40b): undefined reference tospAnimationStateData_setMixByName' obj/release/Classes/spine/CCSkeletonAnimation.o: In function
spine::CCSkeletonAnimation::setAnimation(int, char const*, bool)’:
CCSkeletonAnimation.cpp:(.text+0x479): undefined reference tospAnimationState_setAnimation' obj/release/Classes/spine/CCSkeletonAnimation.o: In function
spine::CCSkeletonAnimation::addAnimation(int, char const*, bool, float)’:
CCSkeletonAnimation.cpp:(.text+0x4f5): undefined reference tospAnimationState_addAnimation' obj/release/Classes/spine/CCSkeletonAnimation.o: In function
spine::CCSkeletonAnimation::getCurrent(int)’:
CCSkeletonAnimation.cpp:(.text+0x528): undefined reference tospAnimationState_getCurrent' obj/release/Classes/spine/CCSkeletonAnimation.o: In function
spine::CCSkeletonAnimation::clearTracks()’:
CCSkeletonAnimation.cpp:(.text+0x538): undefined reference tospAnimationState_clearTracks' obj/release/Classes/spine/CCSkeletonAnimation.o: In function
spine::CCSkeletonAnimation::clearTrack(int)’:
CCSkeletonAnimation.cpp:(.text+0x548): undefined reference tospAnimationState_clearTrack' obj/release/Classes/spine/CCSkeletonAnimation.o: In function
spine::CCSkeletonAnimation::update(float)’:
CCSkeletonAnimation.cpp:(.text+0x5a4): undefined reference tospSkeleton_updateWorldTransform' obj/release/Classes/spine/spine-cocos2dx.o: In function
spRegionAttachment_updateQuad(spRegionAttachment*, spSlot*, cocos2d::_ccV3F_C4B_T2F_Quad*, bool)’:
spine-cocos2dx.cpp:(.text+0x16c): undefined reference tospRegionAttachment_computeWorldVertices' obj/release/Classes/spine/CCSkeleton.o: In function
spine::CCSkeleton::~CCSkeleton()’:
CCSkeleton.cpp:(.text+0xd8): undefined reference tospAtlas_dispose' CCSkeleton.cpp:(.text+0xe4): undefined reference to
spSkeleton_dispose’
CCSkeleton.cpp:(.text+0x10b): undefined reference tospSkeletonData_dispose' obj/release/Classes/spine/CCSkeleton.o: In function
spine::CCSkeleton::boundingBox()’:
CCSkeleton.cpp:(.text+0x80a): undefined reference tospRegionAttachment_computeWorldVertices' obj/release/Classes/spine/CCSkeleton.o: In function
spine::CCSkeleton::setSkeletonData(spSkeletonData*, bool)’:
CCSkeleton.cpp:(.text+0xa5f): undefined reference tospSkeleton_create' obj/release/Classes/spine/CCSkeleton.o: In function
spine::CCSkeleton::CCSkeleton(char const*, spAtlas*, float)’:
CCSkeleton.cpp:(.text+0xc01): undefined reference tospSkeletonJson_create' CCSkeleton.cpp:(.text+0xc2b): undefined reference to
spSkeletonJson_readSkeletonDataFile’
CCSkeleton.cpp:(.text+0xc36): undefined reference tospSkeletonJson_dispose' obj/release/Classes/spine/CCSkeleton.o: In function
spine::CCSkeleton::CCSkeleton(char const*, char const*, float)’:
CCSkeleton.cpp:(.text+0xd41): undefined reference tospAtlas_readAtlasFile' CCSkeleton.cpp:(.text+0xd50): undefined reference to
spSkeletonJson_create’
CCSkeleton.cpp:(.text+0xd7a): undefined reference tospSkeletonJson_readSkeletonDataFile' CCSkeleton.cpp:(.text+0xd85): undefined reference to
spSkeletonJson_dispose’
obj/release/Classes/spine/CCSkeleton.o: In functionspine::CCSkeleton::setSkin(char const*)': CCSkeleton.cpp:(.text+0xeac): undefined reference to
spSkeleton_setSkinByName’
obj/release/Classes/spine/CCSkeleton.o: In functionspine::CCSkeleton::setAttachment(char const*, char const*)': CCSkeleton.cpp:(.text+0xedc): undefined reference to
spSkeleton_setAttachment’
obj/release/Classes/spine/CCSkeleton.o: In functionspine::CCSkeleton::update(float)': CCSkeleton.cpp:(.text+0x160): undefined reference to
spSkeleton_update’
obj/release/Classes/spine/CCSkeleton.o: In functionspine::CCSkeleton::updateWorldTransform()': CCSkeleton.cpp:(.text+0xe48): undefined reference to
spSkeleton_updateWorldTransform’
obj/release/Classes/spine/CCSkeleton.o: In functionspine::CCSkeleton::setToSetupPose()': CCSkeleton.cpp:(.text+0xe58): undefined reference to
spSkeleton_setToSetupPose’
obj/release/Classes/spine/CCSkeleton.o: In functionspine::CCSkeleton::setBonesToSetupPose()': CCSkeleton.cpp:(.text+0xe68): undefined reference to
spSkeleton_setBonesToSetupPose’
obj/release/Classes/spine/CCSkeleton.o: In functionspine::CCSkeleton::setSlotsToSetupPose()': CCSkeleton.cpp:(.text+0xe78): undefined reference to
spSkeleton_setSlotsToSetupPose’
obj/release/Classes/spine/CCSkeleton.o: In functionspine::CCSkeleton::findBone(char const*) const': CCSkeleton.cpp:(.text+0xe88): undefined reference to
spSkeleton_findBone’
obj/release/Classes/spine/CCSkeleton.o: In functionspine::CCSkeleton::findSlot(char const*) const': CCSkeleton.cpp:(.text+0xe98): undefined reference to
spSkeleton_findSlot’
obj/release/Classes/spine/CCSkeleton.o: In functionspine::CCSkeleton::getAttachment(char const*, char const*) const': CCSkeleton.cpp:(.text+0xec8): undefined reference to
spSkeleton_getAttachmentForSlotName’
collect2: error: ld returned 1 exit status
make: *** [bin/release/Wallie] Error 1</blockquote> It obviously a linker error that can't find my spine-c/include/spine/*.h files but I don't see where I'm wrong in the makefile. I cross posted in the Spine forum, without a solution yet. The runtimes provides an example for Android and for Windows, but not for Linux so far. Resources : My bitbucket repo with all the code : https://bitbucket.org/monsieur_h/wallie/src The android Makefile : https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-cocos2dx/example/proj.android/jni/Android.mk Github repo with examples : https://github.com/EsotericSoftware/spine-runtimes/tree/master/spine-cocos2dx