dawnarc
(dawnarc)
1
first I add a macro define in Android.mk file (path is: \Epic Games\4.11\Engine\Build\Android\Java\jni\Android.mk):
LOCAL_CFLAGS += -D_ANDROID_
then I add a macro is my c++ code and use it for logic code:
#ifdef _ANDROID_
#define STRLEN_SAFE(dest, src, len) strncpy(dest, src, len)
#endif
but when I packing my project for android, an error shows in console:
error: use of undeclared identifier 'STRLEN_SAFE’
dawnarc
(dawnarc)
2
by the way, even I add a macro in visual studio, but it has no effect. the compile warning would show again. my VS is 2015.
bonus_uk
(bonus_uk)
3
dawnarc
(dawnarc)
4
thx for your suggestion, but it doesn’t work at all. this is my code:
even I add #define _CRT_SECURE_NO_WARNINGS in cpp file, it also doesn’t work. this’s the same problem with me:
[link text][2]
dawnarc
(dawnarc)
5
I found the solution for latest UE4 version, define your macros in the constructor of MyProject.Build.cs ,like this:
public class MyProj : ModuleRules
{
public MyProj(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Slate", "SlateCore" });
PrivateDependencyModuleNames.AddRange(new string[] { });
Definitions.Add("_CRT_SECURE_NO_WARNINGS");
}
}
also can see example here:
https://github.com/monsieurgustav/UE4-OSC/blob/master/OSC/Source/OSC/OSC.Build.cs