dawnarc
(dawnarc)
March 5, 2016, 4:53am
1
Even I add Macro Definition in file MyProject.Target.cs
public override void SetupGlobalEnvironment(
TargetInfo Target,
ref LinkEnvironmentConfiguration OutLinkEnvironmentConfiguration,
ref CPPEnvironmentConfiguration OutCPPEnvironmentConfiguration
)
{
OutCPPEnvironmentConfiguration.Definitions.Add("_CRT_SECURE_NO_WARNINGS");
}
visual studio also shows warning:
how to add Definition in UE4 project?
dawnarc
(dawnarc)
March 9, 2016, 2:32am
2
can anybody help to resolve this problem?
trojanfoe
(trojanfoe)
March 9, 2016, 8:33am
3
I don’t know the answer to your question; I would tend to avoid strcpy() instead There must be a better way…
Simply put this before the include and try this : #define _CRT_SECURE_NO_WARNINGS 1
if not work try other methods :
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
Hope that help you.
dawnarc
(dawnarc)
March 11, 2016, 2:35pm
6
thx~, but if define macro in code, it’s not convenient build for other platform.
dawnarc
(dawnarc)
March 11, 2016, 2:36pm
7
I found the solution for latest UE4 version, define your macros in the constructor of MyProject.Build.cs ,like this:
using UnrealBuildTool;
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
sswires
(sswires)
March 11, 2016, 10:55pm
8
This tbh, you shouldn’t be using unsafe string copying methods like that unless you’re willing to deal with the potential buffer overrun problems that naturally come from it. Is there also a reason why you’re using the C string functions instead of using Unreal’s FString?
dawnarc
(dawnarc)
March 13, 2016, 3:26am
9
becase I use a third lib which contains strcpy() , if avoid to use strcpy, I have to modify it’s code.
VSZ
(VSZ)
March 25, 2017, 1:11pm
10
I found the solution for latest UE4 version, define your macros in the constructor of MyProject.Build.cs ,like this:
using UnrealBuildTool;
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
Thank you so much for sharing this. I got these warnings just by including Steam’s SDK and all those warnings polluting my squeaky-clean output window were driving me nuts