I'm having trouble using CCHttpRequest
in an Android app that's part of a Cocos2d-x project. Specifically I get a bunch of build errors when building in Eclipse that I don't get when building the iOS app in Xcode.
An example build error that I receive in Eclipse (but not in Xcode) is:
`Type 'CCHttpResponse' could not be resolved`
This error is for the line:
CCHttpResponse *response = (CCHttpResponse *)data;
Both Eclipse and Xcode projects reference the same .cpp
files. To make the Eclipse project aware of the Cocos2d-x extensions I did the following:
Link Folder...
Link to folder in the file system
Note there are some other surprising errors in my HelloWorldScene.cpp
file. For example:
Symbol 'vector' could not be resolved
.
I'm guessing the problem is related to how I've set-up something in Eclipse. Since I'm new to Eclipse I'm not sure what to try. Everything builds and runs fine in the Xcode project.
Edit #1 : After commenting the code responsible for most of the Eclipse build errors I noticed the error:
`make: *** [obj/local/armeabi/libgame.so] Error 1`
I don't know what this means but it seems like it might be a more fundamental error than unresolved symbols.
Android.mk :
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := game_shared
LOCAL_MODULE_FILENAME := libgame
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp \
../../Classes/StringHelper.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,CocosDenshion/android) \
$(call import-module,cocos2dx) \
$(call import-module,extensions)
Application.mk
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1
I think Android.mk
and Application.mk
have some problem, Because in my application Android.mk
is loading more files, and my application is running properly in both platform android and ios. You can see the differences.. it may help you. I am also using cocos2dx
library.
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2dcpp_shared
LOCAL_MODULE_FILENAME := libcocos2dcpp
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/FixPhotoScene.cpp \
../../Classes/SplashScene.cpp \
../../Classes/TableViewTest.cpp\
../../Classes/ProcessImage.cpp \
../../Classes/TestUI.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,cocos2dx)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
$(call import-module,CocosDenshion/android)
$(call import-module,extensions)
$(call import-module,external/Box2D)
$(call import-module,external/chipmunk)
Application.mk
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.