C4668警告

2019-12-07  本文已影响0人  Lif68

分类:UE4C++编程

标签:宏冲突

和win10sdk自带的头文件,比如winioctl.h,中定义的宏产生了冲突,一般情况下,可以有两种解决方法

①用
#include "Windows/AllowWindowsPlatformTypes.h"

#include "Windows/PreWindowsApi.h"

#include "冲突的头文件"

#include "Windows/PostWindowsApi.h"

#include "Windows/HideWindowsPlatformTypes.h"

包裹冲突的头文件,但是在ue4中进行这操作的时候记得generated.h必须放在最下方

参考:https://blog.csdn.net/Jingsongmaru/article/details/99287976

②添加bEnableUndefinedIdentifierWarnings = false;


如项目的默认source,在项目的build.cs中添加
bEnableUndefinedIdentifierWarnings = false;

可以参考如下所示

// Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool;

public class 你的项目名 : ModuleRules

{

public 你的项目名(ReadOnlyTargetRules Target) : base(Target)

{

PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" , "HeadMountedDisplay","Sockets", "Networking" , "ApplicationCore", "SlateCore","Slate" ,"UMG"});

PrivateDependencyModuleNames.AddRange(new string[] {  });

        // Uncomment if you are using Slate UI

        // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

        // Uncomment if you are using online features

        // PrivateDependencyModuleNames.Add("OnlineSubsystem");

        bEnableUndefinedIdentifierWarnings = false;

        // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true

    }

}

同理,如果插件也触发了这个问题,则可以在插件的build.cs加入这段

参考:https://blog.csdn.net/yuxikuo_1/article/details/102799307

上一篇 下一篇

猜你喜欢

热点阅读