(apologies ahead of time for potential lack of detail, on another device. Will clarify and update if necessary once I’m back on my main computer)
Hello!
Decided now was a good time to start learning about Unreal Engine. Something I wanted to move onto was learning about how shaders work. I came across this tutorial
https://www.unrealengine.com/en-US/t…shaders-to-ue4
A bit old, but seemed to play out as Visual Studio didn’t complain about anything.
However, when I compiled my program, I got some linker errors seemingly related to the FShader class which seemed a little surprising since I assume that the class is necessary for all of the built-in shaders and related objects.
Compiler output here:
gistfile1.txt
CompilerResultsLog: Error: NatureOfCodeGameModeBase.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl FDeferredCleanupInterface::FinishCleanup(void)" (?FinishCleanup@FDeferredCleanupInterface@@UEAAXXZ)
CompilerResultsLog: Error: NatureOfCodeGameModeBase.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl FShader::Serialize(class FArchive &)" (?Serialize@FShader@@UEAA_NAEAVFArchive@@@Z)
CompilerResultsLog: Error: NatureOfCodeGameModeBase.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FVertexFactoryParameterRef const * __cdecl FShader::GetVertexFactoryParameterRef(void)const " (?GetVertexFactoryParameterRef@FShader@@UEBAPEBVFVertexFactoryParameterRef@@XZ)
CompilerResultsLog: Error: NatureOfCodeGameModeBase.cpp.obj : error LNK2001: unresolved external symbol "public: virtual unsigned int __cdecl FShader::GetAllocatedSize(void)const " (?GetAllocatedSize@FShader@@UEBAIXZ)
CompilerResultsLog: Error: NatureOfCodeGameModeBase.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FShader::FShader(void)" (__imp_??0FShader@@QEAA@XZ) referenced in function "public: static class FShader * __cdecl FMyTestVS::ConstructSerializedInstance(void)" (?ConstructSerializedInstance@FMyTestVS@@SAPEAVFShader
@@XZ)
CompilerResultsLog: Error: NatureOfCodeGameModeBase.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FShader::~FShader(void)" (__imp_??1FShader@@UEAA@XZ) referenced in function "public: virtual void * __cdecl FGlobalShader::`scalar deleting destructor'(unsigned int)" (??_GFGlobalShader@@UEAAPEAXI@Z)
CompilerResultsLog: Error: NatureOfCodeGameModeBase.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FShaderType::FShaderType(enum FShaderType::EShaderTypeForDynamicCast,wchar_t const *,wchar_t const *,wchar_t const *,unsigned int,int,class FShader * (__cdecl*)(void),class FShaderParametersMetadata const *)" (__imp
_??0FShaderType@@QEAA@W4EShaderTypeForDynamicCast@0@PEB_W11IHP6APEAVFShader@@XZPEBVFShaderParametersMetadata@@@Z) referenced in function "void __cdecl `dynamic initializer for 'public: static class FGlobalShaderType FMyTestVS::StaticType''(void)" (??__E?StaticType@FMyTestVS@@2VFGlobalShaderType@@A@@YAXXZ)
CompilerResultsLog: Error: NatureOfCodeGameModeBase.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FShaderType::~FShaderType(void)" (__imp_??1FShaderType@@UEAA@XZ) referenced in function "public: virtual void * __cdecl FGlobalShaderType::`scalar deleting destructor'(unsigned int)" (??_GFGlobalShaderType@@
This file has been truncated. show original
gistfile2.txt
// AFTER CLEANING UP A BIT, GOT THINGS DOWN TO HERE. IGNORE GISTFILE1.TXT
ic: virtual void __cdecl FDeferredCleanupInterface::FinishCleanup(void)" (?FinishCleanup@FDeferredCleanupInterface@@UEAAXXZ)
CompilerResultsLog: Error: NatureOfCode.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl FShader::Serialize(class FArchive &)" (?Serialize@FShader@@UEAA_NAEAVFArchive@@@Z)
CompilerResultsLog: Error: NatureOfCode.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class FVertexFactoryParameterRef const * __cdecl FShader::GetVertexFactoryParameterRef(void)const " (?GetVertexFactoryParameterRef@FShader@@UEBAPEBVFVertexFactoryParameterRef@@XZ)
CompilerResultsLog: Error: NatureOfCode.cpp.obj : error LNK2001: unresolved external symbol "public: virtual unsigned int __cdecl FShader::GetAllocatedSize(void)const " (?GetAllocatedSize@FShader@@UEBAIXZ)
CompilerResultsLog: Error: NatureOfCode.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FShader::FShader(void)" (__imp_??0FShader@@QEAA@XZ) referenced in function "public: static class FShader * __cdecl FMyTestVS::ConstructCompiledInstance(struct FShader::CompiledShaderInitializerType const &)" (?ConstructCompiled
Instance@FMyTestVS@@SAPEAVFShader@@AEBUCompiledShaderInitializerType@2@@Z)
CompilerResultsLog: Error: NatureOfCode.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl FShader::~FShader(void)" (__imp_??1FShader@@UEAA@XZ) referenced in function "public: virtual void * __cdecl FGlobalShader::`scalar deleting destructor'(unsigned int)" (??_GFGlobalShader@@UEAAPEAXI@Z)
This file has been truncated. show original
Can anyone help explain what might have happened and how I can correctly link things?
For reference in case it helps
Not compiling from source, just using the launcher download version
I’m currently on 4.24.1
Trying to include the shader inside of my game module class.
Running on Windows 10
If there are any other potentially relevant details that would be helpful, please don’t hesitate to ask.
Thanks!
Small update!
After reading a bit more with after a fresh cup of coffee, I noticed some of the missing functions the compiler was calling out existed in the sample C++ class for the Pixel Shader. For whatever reason those functions did not exist in the sample class for the vertex shader. After adding those functions, I’m down to 9 missing references.
Gist has been updated.