UE5编译并以插件形式集成cserialport串口库1-UBT集成与目录结构
// Copyright Epic Games, Inc. All Rights Reserved. using UnrealBuildTool; public class CSerialPort : ModuleRules { public CSerialPort(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; PublicIncludePaths.Add("D:/UnrealProjects/PluginTest/Plugins/CSerialPort/Source/CSerialPort/include/"); 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 ... } ); } }
按理说应该写为相对目录,将整个头文件包含入内
public CSerialPort(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; PublicIncludePaths.Add("D:/UnrealProjects/PluginTest/Plugins/CSerialPort/Source/CSerialPort/include/"); PublicIncludePaths.AddRange( new string[] { // ... add public include paths required here ... } );
目录为
D:\UnrealProjects\PluginTest\Plugins\CSerialPort\Source\CSerialPort

D:\UnrealProjects\PluginTest\Plugins\CSerialPort\Source\CSerialPort\include

D:\UnrealProjects\PluginTest\Plugins\CSerialPort\Source\CSerialPort\include\CSerialPort

在虚幻中新建一个空白插件
实际上这个目录极为重要
浙公网安备 33010602011771号