Inheriting from FStaticMeshSceneProxy throws linker errors

I was looking at the procedural mesh generation tutorial in the wiki and wanted to try something with a staticmesh component but I keep getting linker errors when inheriting from FStaticMeshSceneProxy. I am only overriding the DrawDynamicElements call. So could anyone help me ??

To be more clearer. I just want to inherit from the FStaticMeshSceneProxy interface and make some changes. So has anyone tried it ? If so how ? Thakyou is advance guys :slight_smile:

What exactly are the linker errors you are seeing? Could you paste them here?

Posting the full error messages will help tremendously.

Here is the FGeneratedMeshSceneProxy class , using FPrimitiveSceneProxy instead of FStaticMeshSceneProxy raises no errors


class FGeneratedMeshSceneProxy : public FStaticMeshSceneProxy
	{
	public:

		FGeneratedMeshSceneProxy(UHiglighttableStaticMeshComponent* Component)
			: FStaticMeshSceneProxy(Component)
			
		{
		}

		virtual ~FGeneratedMeshSceneProxy()
		{
			
		}

		virtual void DrawDynamicElements(FPrimitiveDrawInterface* PDI, const FSceneView* View, uint32 DrawDynamicFlags)
		{

		}

		
		virtual uint32 GetMemoryFootprint(void) const { return(sizeof(*this) + GetAllocatedSize()); }

		uint32 GetAllocatedSize(void) const { return(FPrimitiveSceneProxy::GetAllocatedSize()); }

	private:

	};

I am using 4.1 havent upgraded the project yet.

The errors:

Error 23 error MSB3073: The command ““C:\UnrealEngine - 4.1.1\UnrealEngine - 4.1.1\Engine\Build\BatchFiles\Build.bat” MyProjectEditor Win64 Development “C:\Users\i5\Documents\Unreal Projects\MyProject\MyProject.uproject”” exited with code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 38 5 MyProject
Error 20 error LNK2019: unresolved external symbol “public: virtual __cdecl FStaticMeshSceneProxy::FLODInfo::~FLODInfo(void)” (??1FLODInfo@FStaticMeshSceneProxy@@UEAA@XZ) referenced in function “public: void __cdecl TIndirectArray<class FStaticMeshSceneProxy::FLODInfo,class FDefaultAllocator>::Empty(int)” (?Empty@?$TIndirectArray@VFLODInfo@FStaticMeshSceneProxy@@VFDefaultAllocator@@@@QEAAXH@Z) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 8 error LNK2019: unresolved external symbol “public: __cdecl FStaticMeshSceneProxy::FStaticMeshSceneProxy(class UStaticMeshComponent *)” (??0FStaticMeshSceneProxy@@QEAA@PEAVUStaticMeshComponent@@@Z) referenced in function “public: __cdecl public: virtual class FPrimitiveSceneProxy * __cdecl UHiglighttableStaticMeshComponent::CreateSceneProxy(void)'::2’::FGeneratedMeshSceneProxy::FGeneratedMeshSceneProxy(class UHiglighttableStaticMeshComponent *)” (??0FGeneratedMeshSceneProxy@?1??CreateSceneProxy@UHiglighttableStaticMeshComponent@@UEAAPEAVFPrimitiveSceneProxy@@XZ@QEAA@PEAV2@@Z) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 15 error LNK2001: unresolved external symbol “public: virtual void __cdecl FStaticMeshSceneProxy::OnTransformChanged(void)” (?OnTransformChanged@FStaticMeshSceneProxy@@UEAAXXZ) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 19 error LNK2001: unresolved external symbol "public: virtual void __cdecl FStaticMeshSceneProxy::GetLightRelevance(class FLightSceneProxy const *,bool &,bool &,bool &,bool &)const " (?GetLightRelevance@FStaticMeshSceneProxy@@UEBAXPEBVFLightSceneProxy@@AEA_N111@Z) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 13 error LNK2001: unresolved external symbol “public: virtual void __cdecl FStaticMeshSceneProxy::DrawStaticElements(class FStaticPrimitiveDrawInterface *)” (?DrawStaticElements@FStaticMeshSceneProxy@@UEAAXPEAVFStaticPrimitiveDrawInterface@@@Z) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 14 error LNK2001: unresolved external symbol “public: virtual void __cdecl FStaticMeshSceneProxy::DrawDynamicElements(class FPrimitiveDrawInterface *,class FSceneView const *,unsigned int)” (?DrawDynamicElements@FStaticMeshSceneProxy@@UEAAXPEAVFPrimitiveDrawInterface@@PEBVFSceneView@@I@Z) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 17 error LNK2001: unresolved external symbol “public: virtual struct FPrimitiveViewRelevance __cdecl FStaticMeshSceneProxy::GetViewRelevance(class FSceneView const *)” (?GetViewRelevance@FStaticMeshSceneProxy@@UEAA?AUFPrimitiveViewRelevance@@PEBVFSceneView@@@Z) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 16 error LNK2001: unresolved external symbol "public: virtual int __cdecl FStaticMeshSceneProxy::GetLOD(class FSceneView const *)const " (?GetLOD@FStaticMeshSceneProxy@@UEBAHPEBVFSceneView@@@Z) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 11 error LNK2001: unresolved external symbol "public: virtual bool __cdecl FStaticMeshSceneProxy::GetWireframeMeshElement(int,class FMaterialRenderProxy const *,unsigned char,struct FMeshBatch &)const " (?GetWireframeMeshElement@FStaticMeshSceneProxy@@UEBA_NHPEBVFMaterialRenderProxy@@EAEAUFMeshBatch@@@Z) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 9 error LNK2001: unresolved external symbol "public: virtual bool __cdecl FStaticMeshSceneProxy::GetShadowMeshElement(int,unsigned char,struct FMeshBatch &)const " (?GetShadowMeshElement@FStaticMeshSceneProxy@@UEBA_NHEAEAUFMeshBatch@@@Z) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 10 error LNK2001: unresolved external symbol "public: virtual bool __cdecl FStaticMeshSceneProxy::GetMeshElement(int,int,unsigned char,struct FMeshBatch &,bool,bool)const " (?GetMeshElement@FStaticMeshSceneProxy@@UEBA_NHHEAEAUFMeshBatch@@_N1@Z) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 18 error LNK2001: unresolved external symbol "public: virtual bool __cdecl FStaticMeshSceneProxy::CanBeOccluded(void)const " (?CanBeOccluded@FStaticMeshSceneProxy@@UEBA_NXZ) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 12 error LNK2001: unresolved external symbol "protected: virtual void __cdecl FStaticMeshSceneProxy::SetIndexSource(int,int,struct FMeshBatch &,bool,bool)const " (?SetIndexSource@FStaticMeshSceneProxy@@MEBAXHHAEAUFMeshBatch@@_N1@Z) C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\HiglighttableStaticMeshComponent.cpp.obj MyProject
Error 21 error LNK1120: 13 unresolved externals C:\Users\i5\Documents\Unreal Projects\MyProject\Binaries\Win64\UE4Editor-MyProject.dll MyProject
Error 22 error : Failed to produce item: C:\Users\i5\Documents\Unreal Projects\MyProject\Binaries\Win64\UE4Editor-MyProject.dll C:\Users\i5\Documents\Unreal Projects\MyProject\Intermediate\ProjectFiles\ERROR MyProject

All those methods mentioned in the linker errors are not exported by FStaticMeshSceneProxy, which means you can’t subclass it outside whatever module it’s currently defined in, file a bug report on Answerhub. If you don’t mind working with a source build of the engine you should be able to fix this in your engine source by inserting ENGINE_API into the class declaration like so:



class ENGINE_API FStaticMeshSceneProxy : public FPrimitiveSceneProxy


@enlight_2014 your work around works fine. thank you :slight_smile: . Will file the report.