I found the solution, 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