iI was trying to use module VulkanRHI in my project, yet it failed in a weird way while compiling the file(see the head file) that using ue module VulkanRHI
, live coding console output shows “a heap of error about macros in the file VulkanDynamicRHI.h
”(please see the live coding console output), which is the file of VulkanRHI
module, and that lead the building failed and be my problem.
I have done a “prework” since building problem on VulkanRHI I met once, that is G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\IVulkanDynamicRHI.h(15): fatal error C1083: ????????? ??vulkan.h??: No such file or directory
, and my solution is that adding Vulkan module found in UE_5.1\Engine\Source\ThirdParty\Vulkan
. Then the next building problem is that “a heap of error about macros in the file VulkanDynamicRHI.h
”.
In general, here are actually the works I’ve done:
Add Vulkan and VulkanRHI module in .build.cs file.(see the .build.cs file below)
Create a C++ class by ue,the include `<VulkanRHI/Public/VulkanDynamicRHI.h>` and `<Vulkan/Include/vulkan/vulkan.h>` in it(see the head file below)
Save and then compile it by live coding.(see the live coding console output below)
Here are the live coding console output, .build.cs file and the head file:
//live coding console output
Manual recompile triggered
---------- Creating patch ----------
Running G:\UE_5.1\Engine\Build\BatchFiles\Build.bat -Target="SemBiology_2Editor Win64 Development -Project=""G:/ue_project/SemBiology_2/SemBiology_2.uproject""" -LiveCoding -LiveCodingModules="G:/UE_5.1/Engine/Intermediate/LiveCodingModules.txt" -LiveCodingManifest="G:/UE_5.1/Engine/Intermediate/LiveCoding.json" -WaitMutex
Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" -Target="SemBiology_2Editor Win64 Development -Project=""G:/ue_project/SemBiology_2/SemBiology_2.uproject""" -LiveCoding -LiveCodingModules="G:/UE_5.1/Engine/Intermediate/LiveCodingModules.txt" -LiveCodingManifest="G:/UE_5.1/Engine/Intermediate/LiveCoding.json" -WaitMutex
Log file: C:\Users\lenovo\AppData\Local\UnrealBuildTool\Log.txt
Invalidating makefile for SemBiology_2Editor (SemBiology_2.Build.cs modified)
Parsing headers for SemBiology_2Editor
Running Internal UnrealHeaderTool G:\ue_project\SemBiology_2\SemBiology_2.uproject G:\ue_project\SemBiology_2\Intermediate\Build\Win64\SemBiology_2Editor\Development\SemBiology_2Editor.uhtmanifest -WarningsAsErrors -installed
Total of 0 written
Reflection code generated for SemBiology_2Editor in 0.9617705 seconds
Building SemBiology_2Editor...
Using Visual Studio 2022 14.33.31631 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629) and Windows 10.0.22621.0 SDK (D:\Windows Kits\10).
Determining max actions to execute in parallel (8 physical cores, 16 logical cores)
Executing up to 8 processes, one per physical core
Building 10 actions with 8 processes...
[1/10] Compile Symbol.cpp
[2/10] Compile SemBiology_2.cpp
[3/10] Compile SemBiology_2GameModeBase.cpp
[4/10] Compile SemBiology_2GameModeBase.gen.cpp
[5/10] Compile SymbolFunctionLibrary.gen.cpp
[6/10] Compile SymbolFunctionLibrary.cpp
[7/10] Compile Symbol.gen.cpp
[8/10] Compile SemBiology_2.init.gen.cpp
[9/10] Compile VulkanFunctionLibrary.cpp
You have included windows.h before MinWindows.h
All useless stuff from the windows headers won't be excluded !!!
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(302): error C4668: û?????VULKAN_RHI_RAYTRACING?????ΪԤ?????꣬???0???????#if/#elif??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(354): error C2065: ??FVulkanViewport??: δ???ı????
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(354): error C2059: ????????>??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(354): error C2062: ?????͡?unknown-type??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(355): error C2334: ??{?????????????????Եĺ???
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(376): error C2065: ??FVulkanViewport??: δ???ı????
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(376): error C2059: ????????>??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(379): error C2065: ??FVulkanViewport??: δ???ı????
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(379): error C2923: "TRefCountPtr": "FVulkanViewport" ??????"ReferencedType" ???? ģ???????
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(379): note: ?μ?VulkanViewport??????
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(379): error C2955: ??TRefCountPtr??: ʹ? ? ģ???Ҫ ģ?????б?
G:\UE_5.1\Engine\Source\Runtime\Core\Public\Templates\RefCounting.h(144): note: ?μ?RefCountPtr??????
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(394): error C2061: ?????? ?????VulkanInstanceExtensionArray??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(398): error C4668: û?????VULKAN_SUPPORTS_VALIDATION_CACHE?????ΪԤ?????꣬???0???????#if/#elif??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(403): error C4668: û?????VULKAN_SUPPORTS_VALIDATION_CACHE?????ΪԤ?????꣬???0???????#if/#elif??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(436): error C4668: û?????VULKAN_HAS_DEBUGGING_ENABLED?????ΪԤ?????꣬???0???????#if/#elif??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(452): error C2061: ?????? ?????VulkanUniformBuffer??
G:\ue_project\SemBiology_2\Source\SemBiology_2\Private\VulkanFunctionLibrary.cpp(5): error C2039: "checkDevice": ??? "UVulkanFunctionLibrary" ?ij??
G:\ue_project\SemBiology_2\Source\SemBiology_2\Public\VulkanFunctionLibrary.h(10): note: ?μ?VulkanFunctionLibrary??????
G:\ue_project\SemBiology_2\Source\SemBiology_2\Private\VulkanFunctionLibrary.cpp(8): error C4130: ??!=??: ?????????????
G:\ue_project\SemBiology_2\Source\SemBiology_2\Private\VulkanFunctionLibrary.cpp(42): error C2039: "InitCustomVulkan": ??? "UVulkanFunctionLibrary" ?ij??
G:\ue_project\SemBiology_2\Source\SemBiology_2\Public\VulkanFunctionLibrary.h(10): note: ?μ?VulkanFunctionLibrary??????
[10/10] Compile VulkanFunctionLibrary.gen.cpp
You have included windows.h before MinWindows.h
All useless stuff from the windows headers won't be excluded !!!
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(302): error C4668: û?????VULKAN_RHI_RAYTRACING?????ΪԤ?????꣬???0???????#if/#elif??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(354): error C2065: ??FVulkanViewport??: δ???ı????
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(354): error C2059: ????????>??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(354): error C2062: ?????͡?unknown-type??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(355): error C2334: ??{?????????????????Եĺ???
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(376): error C2065: ??FVulkanViewport??: δ???ı????
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(376): error C2059: ????????>??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(379): error C2065: ??FVulkanViewport??: δ???ı????
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(379): error C2923: "TRefCountPtr": "FVulkanViewport" ??????"ReferencedType" ???? ģ???????
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(379): note: ?μ?VulkanViewport??????
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(379): error C2955: ??TRefCountPtr??: ʹ? ? ģ???Ҫ ģ?????б?
G:\UE_5.1\Engine\Source\Runtime\Core\Public\Templates\RefCounting.h(144): note: ?μ?RefCountPtr??????
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(394): error C2061: ?????? ?????VulkanInstanceExtensionArray??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(398): error C4668: û?????VULKAN_SUPPORTS_VALIDATION_CACHE?????ΪԤ?????꣬???0???????#if/#elif??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(403): error C4668: û?????VULKAN_SUPPORTS_VALIDATION_CACHE?????ΪԤ?????꣬???0???????#if/#elif??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(436): error C4668: û?????VULKAN_HAS_DEBUGGING_ENABLED?????ΪԤ?????꣬???0???????#if/#elif??
G:\UE_5.1\Engine\Source\Runtime\VulkanRHI\Public\VulkanDynamicRHI.h(452): error C2061: ?????? ?????VulkanUniformBuffer??
Build failed.
//.build.cs file
using UnrealBuildTool;
public class SemBiology_2 : ModuleRules
{
public SemBiology_2(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[]
{
//Ue Module
"Core", "CoreUObject", "Engine", "InputCore",
});
PrivateDependencyModuleNames.AddRange(new string[] {
//Third party
"Vulkan",
//Ue Module
"VulkanRHI"
});
}
}
// the head file
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include<Vulkan/Include/vulkan/vulkan.h>
#include<VulkanRHI/Public/VulkanDynamicRHI.h>
#include "VulkanFunctionLibrary.generated.h"
UCLASS()
class SEMBIOLOGY_2_API UVulkanFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
};
environment: windows 11, unreal engine 5.1, visual studio 2022
If solving this problem required more infomation,please inform me that what infomation is required.