简体   繁体   中英

Link Error in Unreal Engine

Disclaimer: there is a high chance this is very specific to Unreal Engine, but I haven't got an answer there so I thought I'd try a more general query here. Sorry if this is considered off topic/too specific

I am getting a link error compiling the following code in Unreal Engine 4:

RHISetRenderTarget(TextureRenderTarget->GetRenderTargetTexture(), NULL);

This is being called within a macro ( ENQUEUE_UNIQUE_RENDER_COMMAND_TWOPARAMETER ) but the link error happens even if you don't.

The error itself is:

MaterialToTextureRenderer.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl RHISetRenderTargets(unsigned int,class FRHIRenderTargetView const *,class FRHITexture *,unsigned int,class FRHIUnorderedAccessView * const *)" (__imp_?RHISetRenderTargets@@YAXIPEBVFRHIRenderTargetView@@PEAVFRHITexture@@IPEBQEAVFRHIUnorderedAccessView@@@Z) referenced in function "void __cdecl RHISetRenderTarget(class FRHITexture *,class FRHITexture *)" (?RHISetRenderTarget@@YAXPEAVFRHITexture@@0@Z)

Compressed for readability:

unresolved external symbol: void RHISetRenderTargets(unsigned int, FRHIRenderTargetView const *,FRHITexture *,unsigned int,FRHIUnorderedAccessView * const *)
referenced in: void RHISetRenderTarget(FRHITexture *,FRHITexture *)

(The method the unlinked method is referenced in is the method I am calling).

And 4 other simillar link errors.

I'm not by any stretch of the imagination a C++ expert, but my understanding is a link error is caused when the header file is correctly included but then it can't actual find an implementation of the method to point to.

What I don't understand is, the method whose implementation it can't find, is within the Unreal Engine (which I am assuming doesn't actually have missing method implementations etc!).

Further, both the method I am calling, and the method it is calling (and can't link) are both defined inline in the same header file. The only thing I can see that could be wrong is the method that is being used is declared and implemented further down the header file, but I don't believe that could be a problem (certainly not a link problem).

确保在.build.cs中为这样的目标包含RHI和RenderCore

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "RHI", "RenderCore", "ShaderCore" });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM