UE4第三方库导入

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/AlenCzf/article/details/54141261

先附上官方文档图

如图所示,先在对应的路径里添加库文件,文件夹自己创建:


在Build.cs文件里添加如文档所示的代码,注释我没去掉,红色代码注意添加:

using UnrealBuildTool;
using System.IO;


public class Sea : ModuleRules
{


    private string ModulePath
    {
        get
       {
           return ModuleDirectory;
       }
    }


    private string ThirdPartyPath
    {
        get
        {
           return Path.GetFullPath(Path.Combine(ModulePath, "ThirdParty/encCommDllNFS"));
       }
    }
    public Sea(TargetInfo Target)
    {
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });


        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");


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


        //PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "Includes"));
        //PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "Libraries", "encCommDllNFS.lib"));
        //LoadBobsMagic(Target);
    }
    //public bool LoadBobsMagic(TargetInfo Target)
    //{
    //    bool isLibrarySupported = false;


    //    if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
    //    {
    //        isLibrarySupported = true;


    //        string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "" : "";
    //        string LibrariesPath = Path.Combine(ThirdPartyPath, "Libraries");


    //        /*
    //        test your path with:
    //        using System; // Console.WriteLine("");
    //        Console.WriteLine("... LibrariesPath -> " + LibrariesPath);
    //        */


    //        PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "encCommDllNFS" + PlatformString + ".lib"));
    //    }


    //    if (isLibrarySupported)
    //    {
    //        // Include path
    //        PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "encCommDllNFS.", "Includes"));
    //    }


    //    Definitions.Add(string.Format("WITH_BOBS_MAGIC_BINDING={0}", isLibrarySupported ? 1 : 0));


    //    return isLibrarySupported;
    //}
}

大功告成。

猜你喜欢

转载自blog.csdn.net/AlenCzf/article/details/54141261