2

我正在尝试在 Visual Studio 2013 中编译包括 Android NDK 在内的 Unreal Engine 4 项目,但出现错误我不知道如何解决

PublicIncludePaths.Add("D:/NVPACK/android-ndk-r9c/platforms/android-19/arch-arm/usr/include");

D:\NVPACK\android-ndk-r9c\platforms\android-19\arch-arm\usr\include\sys/cdefs.h(252):致命错误 C1189:#error:“无法重命名函数”

这是导致错误的代码

#ifdef __lint__
#define __RENAME(x) __symbolrename(x)
#else
#error "No function renaming possible"
#endif /* __lint__ */
4

1 回答 1

0

Stupid me! I was trying to compile the source code for Unreal Editor, in other words for Windows. Using Editor Launch/Package for Android is the right way to compile with Android NDK headers.

.Build.cs

if ((Target.Platform == UnrealTargetPlatform.Android))
{
    PublicIncludePaths.Add("D:/NVPACK/android-ndk-r9c/platforms/android-19/arch-arm/usr/include");
}

.cpp

#include "Android/AndroidApplication.h"
...
JNIEnv* Env = FAndroidApplication::GetJavaEnv();
jint VersionJint = Env->GetVersion();
int8 Version = (int8)VersionJint;
GEngine->AddOnScreenDebugMessage(2, 0.5f, FColor::Cyan, FString::FromInt(Version));

Looks like I need exceptions for all #includes too.

于 2015-04-10T19:34:26.400 回答