Download

How do I add a Library to the linker?

I am trying to build Unreal Engine/NVidia Funhouse Project.
Most of the builds succeeded but some of them failed all with LNK2019 erros like this one:


Error	LNK2019	unresolved external symbol NvAPI_D3D11_CreateGeometryShaderEx_2 referenced in function

I believe that this is because i did not set nvapi.lib in the linker as explained on these 2 places:

So I right clicked on the UE4 project, then I opened the properties menu, and tried to find the place in visual studio to add the library as in this example.

But I don’t have most of those menus.

All I have in my project are:

General
Debugging
VC++ Directories
NMake

Screenshot attached. Can anyone tell me where I can find the linker or how I can add NVApi.lib

No_Linker.jpg

Learn to use the UBT system.
You won’t be able to load a lib in Unreal through visual studio, you need proper C# code inside a Build.cs file for that.

Thank You! I would really like to learn more about UBT and working with Build.cs files. Could you point me to the best resource to study this?
I took a quick look at the project and

I found this NVAPI.Build.cs file under C:\Users\Colorado\Desktop\UnrealEngine-VRFunhouse-4.11\Engine\Source\ThirdParty\NVIDIA
vapi
here is what it says:


// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;

public class NVAPI : ModuleRules
{
    public NVAPI(TargetInfo Target)
	{
		Type = ModuleType.External;

        string nvApiPath = UEBuildConfiguration.UEThirdPartySourceDirectory + "NVIDIA/nvapi/";
        PublicSystemIncludePaths.Add(nvApiPath);

		if (Target.Platform == UnrealTargetPlatform.Win64)
		{
            string nvApiLibPath = nvApiPath + "amd64/";
            PublicLibraryPaths.Add(nvApiLibPath);
            PublicAdditionalLibraries.Add("nvapi64.lib");
		}
		else if (Target.Platform == UnrealTargetPlatform.Win32)
		{
            string nvApiLibPath = nvApiPath + "x86/";
            PublicLibraryPaths.Add(nvApiLibPath);
            PublicAdditionalLibraries.Add("nvapi.lib");
		}

	}
}

I confirmed that those files do exist on those paths.
Does this mean that the linker is in fact properly configured to include nvapi.lib?

buildcs.jpg

Linker problem solved

OK I got all the compiler errors to disappear. And thank you Bruno for your input it was very helpful in showing me the root of the problem.
For some reason, I needed to manually replace the nvapi.lib file after the setup was complete
as described by GalaxyMan2015 in this thread https://forums.unrealengine.com/showthread.php?76657-Errors-while-compiling-VXGI

Following those instructions that got rid of all of the LNK2019 build errors.

I would like to learn more about how UBT works if you could point me in the right direction for the best documentation it would be greatly appreciated.

I don’t know of any docs about this; we are all in the dark, what I do is read through the Builder Tool module in engine source and go lurking inside of plugins that are published by default in Engine/Plugins folder.

I just signed in and am posting for the first time ever in UE forums to say Thank You!
I just started messing with UE4 the other day and was not able to figure this out until I found this thread.
My project now builds after recopying the Engine/Source/ThirdParty/NVIDIA/nvapi directory.

I’m not sure if it was the cause, but I specifically cloned the funhouse branch directly, instead of the whole repo.


git checkout --branch VRFunhouse-4.11 https://github.com/NvPhysX/UnrealEngine.git

Regardless, I’m now successfully building VR Funhouse project version 4.11 with VS2013.
Much obliged! :smiley: