0

Android アプリで統合された静的ライブラリをテストしています。残念ながら、コンパイルは機能しません! ここで私を助けてくれますか?

私はいつもエラーが発生します:

jni/main-jni.cpp: In function 'jint Java_com_tmz_cc_MainActivity_test1(JNIEnv*,     jobject)': jni/main-jni.cpp:10:23: error: 'FileSync' has not been declared
make: *** [obj/local/armeabi/objs/ccSharedLib/main-jni.o] Error 1

リンカーによって「FileSync」が知られると思いました。

以下を考えると:

project
+- ..
+-jni
  +- include 
  +- prebuild
     +- libFileSync.a
  +- Android.mk
  +- main-jni.cpp

Android.mk

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE    := fileSyncStaticLibrary
LOCAL_SRC_FILES := prebuild/libFileSync.a
LOCAL_EXPORT_C_INCLUDES := include/
include $(PREBUILT_STATIC_LIBRARY)


include $(CLEAR_VARS)
LOCAL_MODULE    := ccSharedLib
LOCAL_SRC_FILES := main-jni.cpp
LOCAL_STATIC_LIBRARIES := fileSyncStaticLibrary
include $(BUILD_SHARED_LIBRARY)

メイン-jni.cpp

#include <jni.h>
#include <stdio.h>

extern "C" {

jint Java_com_tmz_cc_MainActivity_test1( JNIEnv*  env, jobject  thiz) {


    //FileSync *file = new FileSync("connection");
    jstring seperator = FileSync::getPathSeperator();

    jint temp = 0;
    return temp;
}

jint Java_com_tmz_cc_MainActivity_test2( JNIEnv*  env, jobject  thiz) {

    jint temp = 0;
    return temp;
}

}

エラー:

"Compile++ thumb : ccSharedLib <= main-jni.cpp
Reaping winning child 0x012d6098 PID 19632680 
Cleaning up temp batch file C:\Users\jpenning\AppData\Local\Temp\make4148-1.bat
CreateProcess(C:\android\ndk\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-g++.exe,C:/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi/objs/ccSharedLib/main-jni.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Iinclude/ -IC:/android/ndk/sources/cxx-stl/system/include -Ijni -DANDROID -Wa,--noexecstack -IC:/android/ndk/platforms/android-14/arch-arm/usr/include -c jni/main-jni.cpp -o ./obj/local/armeabi/objs/ccSharedLib/main-jni.o,...)
Live child 0x12d6098 (obj/local/armeabi/objs/ccSharedLib/main-jni.o) PID 19632680 
jni/main-jni.cpp: In function 'jint Java_com_tmz_cc_MainActivity_test1(JNIEnv*, jobject)':
jni/main-jni.cpp:10:23: error: 'FileSync' has not been declared
make: *** [obj/local/armeabi/objs/ccSharedLib/main-jni.o] Error 1
Reaping losing child 0x12d6098 PID 19632680 
Removing child 0x12d6098 PID 19632680 from chain.
4

1 に答える 1

2

などの適切なヘッダー ファイルを含める必要があり#include <FileSync.h>ますmain-jni.cpp

于 2013-05-16T12:27:54.557 に答える