2

在 Xcode 中没有问题,但在 Eclipse 中不幸的是。

我在 Android.mk 中做了这个:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game


LOCAL_MODULE_FILENAME := libgame

LOCAL_SRC_FILES := helloworld/main.cpp \
                   ../../Classes/AppDelegate.cpp \
                   ../../Classes/HelloWorldScene.cpp\
                   ../../Classes/GameplayLayer.cpp\
                   ../../Classes/swimmerc.cpp\
                   ../../Classes/pugixml.cpp

LOCAL_C_INCLUDES := ../../libs/cocos2dx \
../../libs/cocos2dx/platform \
../../libs/cocos2dx/include \
../../libs/CocosDenshion/include \
$(LOCAL_PATH)/../../Classes/\


LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static curl_static

include $(BUILD_SHARED_LIBRARY)
$(call import-module,cocos2dx)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
$(call import-module,CocosDenshion/android) 

我把curl文件夹放在 Classes 中。然后我将它包含在GameplayLayer.cpp. 如果我使用不会发生错误

CURL *curl;
CURLcode res;

但只要我放

   curl = curl_easy_init();

我得到一个错误,

make: *** [obj/local/armeabi/libgame.so] Error 1

请帮忙,我很乐意捐出我的一个肾脏来换取这个 %&#@ 的工作。

我越来越:

undefined reference to `curl_easy_init'
4

1 回答 1

2

我在 Android.mk 中添加了这一行以使其工作。

LOCAL_STATIC_LIBRARIES := curl_static_prebuilt

当然,为了连接到互联网,您还需要编辑 AndroidManifest.mk 并添加以下行:

<uses-permission android:name="android.permission.INTERNET"/> 
于 2012-06-26T09:28:22.250 回答