UnrealEngine4 – error C4668: 没有将“_WIN32_WINNT_WIN10_TH2”定义为预处理器宏,用“0”替换“#if/#elif
UnrealEngine
2020-10-26
518
0
0
百度未收录
本文共1208个字,阅读需要4分钟。
感谢来自使用操作系统为:other
浏览器为:unknown
IP地址为:172.96.247.223
来源网址为:https://www.stubbornhuang.com/944/的朋友,谢谢您的访问!!!
原创文章,作者: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 - 获取UE4最后的渲染缓存数据BackBuffer
- UnrealEngine4 - 将TextureRenderTarget2D保存为图片
- UnrealEngine4 - Can not find such file SceneRenderTargets.h,在UE4 C++层中正确的使用FSceneRenderTargets类
- UnrealEngine4 - 将FTexture2DRHIRef保存为图片
- UnrealEngine4 - C++层打印信息到屏幕
- UnrealEngine4 - error C4668: 没有将“_WIN32_WINNT_WIN10_TH2”定义为预处理器宏,用“0”替换“#if/#elif
- UnrealEngine4 - 关于UObject被自动GC垃圾回收的巨坑
全站随机文章推荐
- C++11 - std::string - stod/stof/stoi/stol/stold/stoll/stoul/stoull,由std::string转换为int/long/float/double等其他类型
- WordPress - 插件OSS Upload与WP Editor.md/WP Githuber MD插件冲突,导致katex公式不正确显示的问题
- 资源分享 - 深入应用C++ 11代码优化与工程级应用(祁宇著)PDF下载
- C++11/std::thread - 线程的基本用法
- Python3爬虫 - 下载反盗链图片的方式
- UnrealEngine4 - C++层打印信息到屏幕
- C++11/std::shared_ptr - 循环引用问题
- 资源分享 - 深度学习 花书 AI圣经(Deep Learning) 英文pdf下载
- OpenCV - 使用findContours()查找图片轮廓线,并将轮廓线坐标点输出
- 资源分享 - PHP与MySQL程序设计(第4版) 中文 PDF下载