虚幻引擎4链接静态第三方库/SDK(libZPlay)
Unreal Engine 4 linking static 3rd party library/SDK (libZPlay)
我正在尝试将一个静态第三方库链接到虚幻引擎4。
我正在尝试包含一个名为libZPlay的第三方库/SDK。我试着遵循"使用构建系统链接静态库"wiki指南,但是遇到了问题。我使用的是UE4.8.0,libZPlay是一个32位库。
以下是我在遵循指南后的当前构建文件:
using UnrealBuildTool;
using System.IO;
public class Rhythm : ModuleRules{
//for linking 3rd party libraries
private string ModulePath{
get { return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); }
}
private string ThirdPartyPath{
get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
}
//normal after this
public Rhythm(TargetInfo Target){
MinFilesUsingPrecompiledHeaderOverride = 1;//faster builds
bFasterWithoutUnity = true;//faster builds
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });//for UMG
LoadlibZPlay(Target); //load libZPlay library
}
public bool LoadlibZPlay(TargetInfo Target){
bool isLibrarySupported = false;
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32)){
isLibrarySupported = true;
string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86"; //prob not needed since only one version of the file
string LibrariesPath = Path.Combine(ThirdPartyPath, "libZPlay", "Libraries");
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libzplay.lib"));
//PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libzplay_borland.lib"));
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libzplay.a"));
//PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libzplay.dll"));
PublicDelayLoadDLLs.Add(Path.Combine(LibrariesPath, "libzplay.dll"));
}
if (isLibrarySupported){
//include path
PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "libZPlay", "Includes"));
}
Definitions.Add(string.Format("WITH_LIBZPLAY_BINDING={0}", isLibrarySupported ? 1 : 0));
return isLibrarySupported;
}
}
我在项目的根目录中有一个ThirdParty文件夹,其中有一个libZPlay文件夹,其中包含一个包含我的头文件的Includes文件夹。此外,在libZPlay文件夹中还有一个Libraries文件夹,其中包含我的libZPlay.dll、libZPlay.lib和libZPlay.a文件。头文件以以下方式包含:#include"../../ThirdParty/libZPlay/Includes/libZPlay.h"。添加所有这些之后,visual studio文件也被重新生成。
我试着从上述外部库运行一个名为"CreateZPlay()"的函数,如下所示:
void UMusicAnalyzerWidget::initilizeMusicAnalyzer(){
player = libZPlay::CreateZPlay();
filePath = "D:/Christian/Music/Archive/Stick Me In My Heart (Radio Edit).mp3";
}
"player"是在UMusicAnalyzerWidget类中创建的ZPlay指针,该函数几乎创建并初始化对象。然而,当尝试构建/编译时,我会遇到以下错误:
Error 8 error LNK2019: unresolved external symbol __imp_CreateZPlay referenced in function "public: void __cdecl UMusicAnalyzerWidget::execinitilizeMusicAnalyzer(struct FFrame &,void * const)" (?execinitilizeMusicAnalyzer@UMusicAnalyzerWidget@@QEAAXAEAUFFrame@@QEAX@Z) D:GitHubRhythmRhythmIntermediateProjectFilesMusicAnalyzerWidget.cpp.obj Rhythm
Error 9 error LNK1120: 1 unresolved externals D:GitHubRhythmRhythmBinariesWin64UE4Editor-Rhythm.dll 1 1 Rhythm
Error 10 error : Failed to produce item: D:GitHubRhythmRhythmBinariesWin64UE4Editor-Rhythm.dll D:GitHubRhythmRhythmIntermediateProjectFilesERROR Rhythm
Error 11 error MSB3075: The command ""D:ProgramsEpic Games4.8EngineBuildBatchFilesRebuild.bat" RhythmEditor Win64 Development "D:GitHubRhythmRhythmRhythm.uproject" -rocket" exited with code 5. Please verify that you have sufficient rights to run this command. C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V120Microsoft.MakeFile.Targets 43 5 Rhythm
经过一番东张西望,我被卡住了,不知道该怎么办。我认为这可能是因为这是一个32位库(没有任何64位版本),而虚幻引擎4只能以64位编译。任何见解都会很棒!
您提供的链接实际上证实了您对UE4不支持32位库的怀疑:
通过一个标准的静态库项目,我们将以x86(32位)机器为目标,这不适用于UE4工具集。
您将需要一个64位版本。
相关文章:
- 使用外部SDK工具链文件在VisualStudio上生成项目编译错误
- Vulkan SDK 版本 1.1.85.0 在 Kubuntu 18.10 上链接
- 升级到 Windows 10 版本 1809 SDK 后,我无法编译使用 C++/WinRT 的项目
- 在设计 SDK 时,我是否应该在 C++ 头文件中完全隐藏内部类?
- Eventloop 卡住:NAO C++ SDK OnFaceDetection 示例
- 构建失败错误:无法使用 qibuild 构建C++ SDK Helloworld
- Microsoft C++ 用于图形 API 的 Rest SDK
- 如何检索 Steamwork SDK 的当前版本
- 佳能SDK无法从相机下载图片
- 如何使用 CPP REST SDK 实现 CAS(中央认证服务)?
- 在为 iOS 构建 aws-sdk-cpp 时,cmake 上的 CXX 编译器错误已损坏
- 关于 API 文档和设备操作 在助手-sdk-cpp 上
- C++标准视窗 SDK 文件中的编译错误
- DLL:当 SDK 头文件不使用 __declspec(dllexport) 时,我可以使用它吗
- 将 aws-iot-device-sdk-cpp-v2 与 CMake 结合使用
- "byte":使用Crypto++和Windows SDK时出现不明确的符号错误
- FBX SDK 在预期 3 个顶点时返回 4 个顶点
- Qt & Firebase C++ SDK 在 iOS 上的链接问题
- Yocto-bitbake与SDK系统根冲突
- 虚幻引擎4链接静态第三方库/SDK(libZPlay)