Closed shenyu0403 closed 5 years ago
alright, it just import /we4668 into UBT of ue4.20, i modified it to /wd4668 and it worked...
I'm trying to figure this out for a week. What I understand that you can change /we4668 to /w44668 to have it as warning by CompileEnvironment.bUndefinedIdentifierWarningsAsErrors in VCToolChain.cs. Not sure where you can set this.
But I traced undefined error (one example of it) up to WindowsSystemIncludes.h where there is THIRD_PARTY_INCLUDES_START. In that macro there should be:
#ifndef PRAGMA_DISABLE_UNDEFINED_IDENTIFIER_WARNINGS
#define PRAGMA_DISABLE_UNDEFINED_IDENTIFIER_WARNINGS \
__pragma(warning(push)) \
__pragma(warning(disable: 4668)) /* 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' */
#endif // PRAGMA_DISABLE_UNDEFINED_IDENTIFIER_WARNINGS
That should disable those errors in included third party files. It works without fastbuild. But for some reason it won't work in all cases with fastbuild.
In WindowsSystemIncludes.h I tried this:
#if TESTXYZ1
#endif
// SIMD intrinsics
THIRD_PARTY_INCLUDES_START
#if TESTXYZ2
#endif
I try to compile UnrealHeaderTool
WindowsSystemIncludes.h(14): error C4668: 'TESTXYZ1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
WindowsSystemIncludes.h(18): error C4668: 'TESTXYZ2' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
intsafe.h(66): error C4668: '__midl' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
...
WindowsSystemIncludes.h(14): error C4668: 'TESTXYZ1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
WindowsSystemIncludes.h(14): warning C4668: 'TESTXYZ1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
So it looks like fastbuild use __pragma(warning(disable: 4668)) in PRAGMA_DISABLE_UNDEFINED_IDENTIFIER_WARNINGS , because I don't see TEXTXYZ2 as second warning in 3. test. But for some reason, when /we4668 is as command line parameter it isn't disabled by that pragma warning.
I checked that fastbuild and default unreal build run cl.exe with same cmd parameters.
Leave /w44668 alone; replace /we4668 with /wd4668. This solves the issue and works with 4.21 .
Fixed
@yass007 Would you mind pointing to the piece of code that fixed this particular issue?
@hougantcfvl I was wondering this as well. I did it in a super hacky way in FASTBuild.cs
OtherCompilerOptions = OtherCompilerOptions.Replace("we4668", "wd4668");
If I work out the correct way of doing it, I'll update the thread
Thanks for your job of this integration, i just tried it with unreal 4.20, but got a lot of error like below for only compiling UrealHeaderTool.
3>------ Rebuild All started: Project: UnrealHeaderTool, Configuration: Development_Program x64 ------ 3>Cleaning UnrealHeaderTool Binaries... 3>Creating makefile for UnrealHeaderTool (no existing makefile) 3>Performing full C++ include scan (no include cache file) 3>Using Visual Studio 2017 14.14.26428 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428) and Windows 10.0.16299.0 SDK (C:\Program Files (x86)\Windows Kits\10). 3>Create bff file in 0.0312991 seconds. 3>BFF file 'E:\UE4.20r\NEXT\Engine\Intermediate\Build\fbuild.bff' has changed (reparsing will occur). 3>Distributed Compilation : 7 Workers in pool 3>8> Obj: E:\UE4.20r\NEXT\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\PCLaunch.rc.res 3>3> Obj: E:\UE4.20r\NEXT\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\UnrealHeaderTool\PCLaunch.rc.res 3>5> Obj: E:\UE4.20r\NEXT\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\BuildSettings\Module.BuildSettings.cpp.obj 3>2> Obj: E:\UE4.20r\NEXT\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\CoreUObject\PCH.CoreUObject.h.pch 3>7> Obj: E:\UE4.20r\NEXT\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\Core\SharedPCH.Core.h.pch 3>6> Obj: E:\UE4.20r\NEXT\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\UnrealHeaderTool\Module.UnrealHeaderTool.cpp.obj 3>1> Obj: E:\UE4.20r\NEXT\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\Core\PCH.Core.h.pch 3>4> Obj: E:\UE4.20r\NEXT\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\BuildSettings\Module.BuildSettings.cpp.obj <LOCAL> 3>3> Lib: E:\UE4.20r\NEXT\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\BuildSettings\UnrealHeaderTool-BuildSettings.lib 3>8> Exe: E:\UE4.20r\NEXT\Engine\Binaries\Win64\UnrealHeaderTool-BuildSettings.dll 3>6> Failed to build Object (error 0x2) 'E:\UE4.20r\NEXT\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\UnrealHeaderTool\Module.UnrealHeaderTool.cpp.obj' 3>6> PROBLEM: E:\UE4.20r\NEXT\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\UnrealHeaderTool\Module.UnrealHeaderTool.cpp.obj 3>Module.UnrealHeaderTool.cpp 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared\intsafe.h(66): error C4668: '__midl' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winnt.h(310): error C4668: '_M_HYBRID' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winnt.h(318): error C4668: '_M_HYBRID' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winnt.h(12901): error C4668: '_WIN32_WINNT_WIN10_RS3' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winnt.h(18578): error C4668: '_APISET_RTLSUPPORT_VER' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\minwinbase.h(204): error C4668: '_WIN32_WINNT_WIN10_RS1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\interlockedapi.h(84): error C4668: '_APISET_INTERLOCKED_VER' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\processthreadsapi.h(1116): error C4668: '_WIN32_WINNT_WIN10_RS3' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\securitybaseapi.h(405): error C4668: '_APISET_SECURITYBASE_VER' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\securitybaseapi.h(548): error C4668: '_APISET_SECURITYBASE_VER' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\securitybaseapi.h(1532): error C4668: '_APISET_SECURITYBASE_VER' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\securitybaseapi.h(1568): error C4668: '_APISET_SECURITYBASE_VER' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\securitybaseapi.h(1589): error C4668: '_APISET_SECURITYBASE_VER' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winbase.h(8504): error C4668: '_WIN32_WINNT_WIN10_RS1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winbase.h(8509): error C4668: '_WIN32_WINNT_WIN10_RS3' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winbase.h(8514): error C4668: '_WIN32_WINNT_WIN10_RS1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winbase.h(8561): error C4668: '_WIN32_WINNT_WIN10_RS1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' 3>C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winbase.h(8958): error C4668: 'NTDDI_WIN7SP1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
it seems it can't go through the preprocessor of some head code in Windows SDK 10...