0
Google Testフレームワークを使用してAndroid NDKコード用の単体テストをコンパイルしようとしています。私のコードは、ほぼそのままREADMEを、次のとおりです。Android NDKでGoogleテストケースをコンパイルしていますか?
Application.mk
APP_STL := gnustl_shared
Android.mk
# Build module
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jniLib
LOCAL_SRC_FILES := jniLib.cpp
include $(BUILD_SHARED_LIBRARY)
# Build unit tests
include $(CLEAR_VARS)
LOCAL_MODULE := jniLib_unittest
LOCAL_SRC_FILES := jniLib_unittest.cpp
LOCAL_SHARED_LIBRARIES := jniLib
LOCAL_STATIC_LIBRARIES := googletest_main
include $(BUILD_EXECUTABLE)
$(call import-module,third_party/googletest)
jniLib.cpp
jint Java_test_nativetest_MainActivity_add(JNIEnv* env, jobject jThis, jint x, jint y) {
return x + y;
}
jniLib.h
#pragma once
#include <jni.h>
extern "C" {
jint Java_test_nativetest_MainActivity_add(JNIEnv* env, jobject jThis, jint x, jint y);
}
私はjniLib_unittest.cpp
ndk-build
でビルドしようとすると10
#include <gtest/gtest.h>
Test(AddTest, FivePlusFive) {
EXPECT_EQ(10, add(5, 5));
}
、私は次のコンパイルエラーが表示されます。
jni/jniLib_unittest.cpp:10:9: error: expected constructor, destructor, or type
conversion before '(' token make.exe:
*** [obj/local/armeabi/objs/jniLib_unittest/jniLib_unittest.o] Error 1
は私が間違って何をしているのですか?