UnrealEngine4 – error C4668: 没有将“_WIN32_WINNT_WIN10_TH2”定义为预处理器宏,用“0”替换“#if/#elif
UnrealEngine
2020-10-26
374
0
0
百度未收录
本文共1208个字,阅读需要4分钟。
感谢来自使用操作系统为:other
浏览器为:unknown
IP地址为:3.239.33.139
来源网址为:的朋友,谢谢您的访问!!!
原创文章,作者:StubbornHuang,如若转载,请注明出处:《UnrealEngine4 – error C4668: 没有将“_WIN32_WINNT_WIN10_TH2”定义为预处理器宏,用“0”替换“#if/#elif》https://www.stubbornhuang.com/944/
1 错误原因
出现这种错误,一般为Windows中的宏与UE4冲突所导致。
2 解决方法
2.1 修改插件xxxx.Build.cs
在插件xxxx.Build.cs中加入以下代码:
bEnableUndefinedIdentifierWarnings = false;
完整插件xxxx.Build.cs代码示例:
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class TwowaySocketPlugin : ModuleRules
{
public TwowaySocketPlugin(ReadOnlyTargetRules Target) : base(Target)
{
bEnableUndefinedIdentifierWarnings = false;
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
2.2 使用UE4包含机制解决
使用以下代码包含起冲突的Windows相关的头文件:
#include "Windows/AllowWindowsPlatformTypes.h"
#include "Windows/PreWindowsApi.h"
// 包含起冲突的头文件,例如
#include <windows.h>
#include "Windows/PostWindowsApi.h"
#include "Windows/HideWindowsPlatformTypes.h"
当前分类随机文章推荐
- UnrealEngine4 - 将FTexture2DRHIRef保存为图片
- UnrealEngine4 - error C4668: 没有将“_WIN32_WINNT_WIN10_TH2”定义为预处理器宏,用“0”替换“#if/#elif
- UnrealEngine4 - 获取UE4最后的渲染缓存数据BackBuffer
- UnrealEngine4 - 将TextureRenderTarget2D保存为图片
- UnrealEngine4 - C++层打印信息到屏幕
- UnrealEngine4 - Can not find such file SceneRenderTargets.h,在UE4 C++层中正确的使用FSceneRenderTargets类
- UnrealEngine4 - 关于UObject被自动GC垃圾回收的巨坑
全站随机文章推荐
- 资源分享 - The NURBS Book (2nd,Les Pieg) 英文版PDF下载
- WordPress - 禁用XML-RPC接口,禁止访问xmlrpc.php,避免DDOS攻击,防止暴力破解
- 姿态估计之human3.6m数据集骨骼关节keypoint标注对应
- 资源下载 - Go语言实战WilliamKennedy高清带书签PDF下载
- WordPress - 使用插件的方式作出类似向主题function.php中添加代码的功能
- Modern OpenGL从零开始 - 从茫茫多的OpenGL第三方库讲起
- 资源分享 - GPU Gems/GPU 精粹(1-3) 高清PDF下载
- Duilib - 字体
- WordPress - 修改管理后台登录地址,防止恶意爆破
- 一文带你从欧拉角的角度搞懂左手坐标系到右手坐标系的转换