# Link error when extending from APostProcessVolume class

**URL:** <https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954>\
**Category:** Rendering\
**Tags:** linker, Post-Processing, linker-error, unreal-engine, question, CPP, linking-error\
**Created:** [November 26, 2014, 9:33pm UTC](https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954 "2014-11-26T21:33:33Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![UDGMohammed](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UDGMohammed](https://forums.unrealengine.com/u/UDGMohammed)\
**Post date:** [November 26, 2014, 9:33pm UTC](https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954/1 "2014-11-26T21:33:33Z")

</div>

Hello,

I auto generate a class that inherits from APostProcessVolume I get the following link errors on Visual Studio:

```
1>MyPostProcessVolume.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl APostProcessVolume::PostUnregisterAllComponents(void)" (?PostUnregisterAllComponents@APostProcessVolume@@UEAAXXZ)
1>test.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl APostProcessVolume::PostUnregisterAllComponents(void)" (?PostUnregisterAllComponents@APostProcessVolume@@UEAAXXZ) referenced in function "class UClass *__cdecl Z_Construct_UClass_AtestProjectile(void)" (?Z_Construct_UClass_AtestProjectile@@YAPEAVUClass@@XZ)
1>MyPostProcessVolume.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl APostProcessVolume::PostRegisterAllComponents(void)" (?PostRegisterAllComponents@APostProcessVolume@@MEAAXXZ)
1>test.generated.cpp.obj : error LNK2019: unresolved external symbol "protected: virtual void __cdecl APostProcessVolume::PostRegisterAllComponents(void)" (?PostRegisterAllComponents@APostProcessVolume@@MEAAXXZ) referenced in function "class UClass *__cdecl Z_Construct_UClass_AtestProjectile(void)" (?Z_Construct_UClass_AtestProjectile@@YAPEAVUClass@@XZ)
1>MyPostProcessVolume.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl APostProcessVolume::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@APostProcessVolume@@UEAAXAEAUFPropertyChangedEvent@@@Z)
1>test.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual void __cdecl APostProcessVolume::PostEditChangeProperty(struct FPropertyChangedEvent &)" (?PostEditChangeProperty@APostProcessVolume@@UEAAXAEAUFPropertyChangedEvent@@@Z) referenced in function "class UClass *__cdecl Z_Construct_UClass_AtestProjectile(void)" (?Z_Construct_UClass_AtestProjectile@@YAPEAVUClass@@XZ)
1>MyPostProcessVolume.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl APostProcessVolume::CanEditChange(class UProperty const *)const " (?CanEditChange@APostProcessVolume@@UEBA_NPEBVUProperty@@@Z)
1>test.generated.cpp.obj : error LNK2019: unresolved external symbol "public: virtual bool __cdecl APostProcessVolume::CanEditChange(class UProperty const *)const " (?CanEditChange@APostProcessVolume@@UEBA_NPEBVUProperty@@@Z) referenced in function "class UClass *__cdecl Z_Construct_UClass_AtestProjectile(void)" (?Z_Construct_UClass_AtestProjectile@@YAPEAVUClass@@XZ)
1>D:\Unreal Project\test\Binaries\Win64\UE4Editor-test.dll : fatal error LNK1120: 4 unresolved externals

```

I tested this on both 4.2.1 and 4.5.1 with the same result. Is there any solution to this?

Thank you.

---

<div class="post-metadata">

**Author:** ![AlonzoMachiraju](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlonzoMachiraju](https://forums.unrealengine.com/u/AlonzoMachiraju)\
**Post date:** [December 9, 2014, 4:20am UTC](https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954/2 "2014-12-09T04:20:04Z")

</div>

Did you remember to include PostProcessVolume.h into your subclass’s .h file?

---

<div class="post-metadata">

**Author:** ![vibgyorc6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vibgyorc6](https://forums.unrealengine.com/u/vibgyorc6)\
**Post date:** [December 19, 2014, 11:42pm UTC](https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954/3 "2014-12-19T23:42:41Z")

</div>

I don’t speak for UDGMohammed, but I included the file and I’m getting the exact same errors.

---

<div class="post-metadata">

**Author:** ![BingoBongo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BingoBongo](https://forums.unrealengine.com/u/BingoBongo)\
**Post date:** [May 24, 2015, 7:11pm UTC](https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954/4 "2015-05-24T19:11:37Z")

</div>

+1 .same error

---

<div class="post-metadata">

**Author:** ![BingoBongo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BingoBongo](https://forums.unrealengine.com/u/BingoBongo)\
**Post date:** [May 24, 2015, 7:59pm UTC](https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954/5 "2015-05-24T19:59:15Z")

</div>

Copy this code to .cpp file:

```
#if WITH_EDITOR
void APostProcessVolume::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
	Super::PostEditChangeProperty(PropertyChangedEvent);

	static const FName NAME_Blendables = FName(TEXT("Blendables"));

	if (PropertyChangedEvent.Property && PropertyChangedEvent.Property->GetFName() == NAME_Blendables)
	{
		// remove unsupported types
		/*
		{
			uint32 Count = Settings.Blendables.Num();
			for (uint32 i = 0; i < Count; ++i)
			{
				UObject* Obj = Settings.Blendables[i];

				if (!Cast<IBlendableInterface>(Obj))
				{
					Settings.Blendables[i] = 0;
				}
			}
		}*/
	}
}

bool APostProcessVolume::CanEditChange(const UProperty* InProperty) const
{
	if (InProperty)
	{
		FString PropertyName = InProperty->GetName();

		if (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(APostProcessVolume, bEnabled))
		{
			return true;
		}

		if (!bEnabled)
		{
			return false;
		}

		if (PropertyName == GET_MEMBER_NAME_STRING_CHECKED(APostProcessVolume, BlendRadius))
		{
			if (bUnbound)
			{
				return false;
			}
		}
	}

	return Super::CanEditChange(InProperty);
}

#endif // WITH_EDITOR

void InsertVolume(IInterface_PostProcessVolume* Volume, TArray< IInterface_PostProcessVolume* >& VolumeArray)
{
	const int32 NumVolumes = VolumeArray.Num();
	float TargetPriority = Volume->GetProperties().Priority;
	int32 InsertIndex = 0;
	// TODO: replace with binary search.
	for (; InsertIndex < NumVolumes; InsertIndex++)
	{
		IInterface_PostProcessVolume* CurrentVolume = VolumeArray[InsertIndex];
		float CurrentPriority = CurrentVolume->GetProperties().Priority;

		if (TargetPriority < CurrentPriority)
		{
			break;
		}
		if (CurrentVolume == Volume)
		{
			return;
		}
	}
	VolumeArray.Insert(Volume, InsertIndex);
}

void APostProcessVolume::PostUnregisterAllComponents()
{
	// Route clear to super first.
	Super::PostUnregisterAllComponents();
	// World will be NULL during exit purge.
	if (GetWorld())
	{
		GetWorld()->PostProcessVolumes.RemoveSingle(this);
	}
}

void APostProcessVolume::PostRegisterAllComponents()
{
	// Route update to super first.
	Super::PostRegisterAllComponents();
	InsertVolume(this, GetWorld()->PostProcessVolumes);
}
```

---

<div class="post-metadata">

**Author:** ![UnexpectedSquirt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnexpectedSquirt](https://forums.unrealengine.com/u/UnexpectedSquirt)\
**Post date:** [July 19, 2016, 4:04pm UTC](https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954/6 "2016-07-19T16:04:22Z")

</div>

same problem. (4.12)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [July 19, 2016, 5:33pm UTC](https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954/7 "2016-07-19T17:33:00Z")

</div>

The PostProcessVolume class is marked with the MinimalAPI specifier in its UCLASS macro. To use the class without getting the error, you should be able to open the [ProjectName].h file for your project and change the include path from `#include "EngineMinimal.h"` to `#include "Engine.h"`

Cheers

---

<div class="post-metadata">

**Author:** ![UnexpectedSquirt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnexpectedSquirt](https://forums.unrealengine.com/u/UnexpectedSquirt)\
**Post date:** [July 19, 2016, 5:43pm UTC](https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954/8 "2016-07-19T17:43:49Z")

</div>

my project header already includes Engine.h …

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [July 19, 2016, 6:11pm UTC](https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954/9 "2016-07-19T18:11:44Z")

</div>

After further investigation, I was mistakenly confusing MinimalAPI with EngineAPI. If a class is marked as EngineAPI, having the include statement for Engine.h allows it to be used. For something that is marked as MinimalAPI, this means that it is not available outside of source code and can’t be extended. If you are using a source version of the engine you can change MinimalAPI to EngineAPI in the PostProcessVolume.h file.

---

<div class="post-metadata">

**Author:** ![UnexpectedSquirt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnexpectedSquirt](https://forums.unrealengine.com/u/UnexpectedSquirt)\
**Post date:** [July 19, 2016, 6:16pm UTC](https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954/10 "2016-07-19T18:16:27Z")

</div>

Hmm. Yeah, I guess I can make that change. I have really been trying my hardest to avoid engine level changes as they increase the complexity of merges with future versions of the engine. Is this change something you guys could introduce yourselves with a future release ? Subclassing PostProcessVolume seems like it would be a fairly common thing to do in many projects …

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [July 19, 2016, 7:34pm UTC](https://forums.unrealengine.com/t/link-error-when-extending-from-apostprocessvolume-class/299954/11 "2016-07-19T19:34:38Z")

</div>

MinimalAPI classes can still be cast to, but functions of the class can’t be called unless they are specifically exposed as inline functions. This is done to help improve compile times. Additionally, marking PostProcessVolume as EngineAPI would most likely also lead to cascading additional classes needing to be exposed as well which would further increase the compile time. Since the source code is available to make changes on a case by case basis, this feature is unlikely to change in the future.
