Hello,
I’ve been trying to build a simple demo project using CMake, Qt Creator and MSVC compiler.
I generated prebuilt libraries and proceeded to linking my project.
I started with just “libcocos2d_2013.lib”, but the linker complained, so I added the following ones as well:
target_link_libraries(${APP_NAME}
${CMAKE_SOURCE_DIR}/Libs/libcocos2d_2013.lib
${CMAKE_SOURCE_DIR}/Libs/libpng.lib
${CMAKE_SOURCE_DIR}/Libs/libjpeg.lib
${CMAKE_SOURCE_DIR}/Libs/libtiff.lib
${CMAKE_SOURCE_DIR}/Libs/glfw3.lib
${CMAKE_SOURCE_DIR}/Libs/libchipmunk.lib
${CMAKE_SOURCE_DIR}/Libs/libbox2d_2013.lib
${CMAKE_SOURCE_DIR}/Libs/libSpine_2013.lib
${CMAKE_SOURCE_DIR}/Libs/librecast_2013.lib
${CMAKE_SOURCE_DIR}/Libs/libbullet_2013.lib
)
I’m getting a huge pile of LNK2019 and LNK2001 “unresolved external symbol” errors. Like this:
AppDelegate.cpp.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl cocos2d::Rect::Rect(float,float,float,float)" (??0Rect@cocos2d@@QEAA@MMMM@Z) referenced in function "public: virtual bool __cdecl AppDelegate::applicationDidFinishLaunching(void)" (?applicationDidFinishLaunching@AppDelegate@@UEAA_NXZ)
I’ve also tried building that demo for Android using command line with following lines preceding my actual project in Android.mk:
LOCAL_MODULE := cocos2d_static
LOCAL_SRC_FILES := ../../Libs/libcocos2d.a
LOCAL_C_INCLUDES := ../../headers/cocos
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
I get pretty much the same pile of linker errors.
I got a feeling like I’m missing something most people consider obvious here. Can anyone explain?