我有一个具有c ++功能的Xamarin.Android应用程序和库。我的头文件“ pch.h”给了我4个无法打开源文件的错误。 注意:我尚未创建.cpp或.h文件,因此不确定是否丢失了某些内容。
pch.h
#include <jni.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/resource.h>
#include <android/log.h>
libtest.cpp
#include "libtest.h"
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "SharedObject1", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "SharedObject1", __VA_ARGS__))
extern "C" {
/* Diese triviale Funktion gibt den Plattform-ABI zurück, für die diese native dynamische Bibliothek kompiliert wurde.*/
const char * test::getPlatformABI()
{
#if defined(__arm__)
#if defined(__ARM_ARCH_7A__)
#if defined(__ARM_NEON__)
#define ABI "armeabi-v7a/NEON"
#else
#define ABI "armeabi-v7a"
#endif
#else
#define ABI "armeabi"
#endif
#elif defined(__i386__)
#define ABI "x86"
#else
#define ABI "unknown"
#endif
LOGI("This dynamic shared library is compiled with ABI: %s", ABI);
return "This native library is compiled with ABI: %s" ABI ".";
}
void test()
{
}
double timestwo(double a) {
return a * 2;
}
test::test()
{
}
test::~test()
{
}
}