'Unresolved external symbol' calling a static function from a plugin

Hi,

I have a plugin (from Stereolabs to access a stereocamera in unreal) and another one to access the PointCloudLibrary (pcl).

In an Actor class in my game I want to access a static method I wrote in the Stereolabs plugin:
static ESlRetrieveResult GetPointCloudAtRoi(FBox2D ROI, pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr & PointcloudOut, float MinConfidence = 0, float MaxConfidence = 100);

I cannot make this a UFunction, because the Pointcloud Pointer is not known by unreal. But as it is a public static method I should be able to access it like this:

bool AZedPointcloudFactory::GetPointcloudFromZED(FBox2D ROI)
{
	ESlRetrieveResult result = UZEDFunctionLibrary::GetPointCloudAtRoi(ROI, Pointcloud, MinConfidence, MaxConfidence);
	return result == ESlRetrieveResult::RR_RetrieveValid;
}

But when I try to compile, i get this error:

unresolved external symbol “__declspec(dllimport) public: static enum ESlRetrieveResult __cdecl UZEDFunctionLibrary::GetPointCloudAtRoi(struct FBox2D,class boost::shared_ptr > &,float,float)” …

I did include the Plugin Modules in my Game.Build.cs and when I call another static Method (being a UFunction this time) from the UZEDFunctionLibrary, everything is fine.

Do you know if this is because one is a UFunction and the other one isnt? Or what else could case this issue?
Thanks for any help!

Hello,

I don’t know what are this functions but you might didn’t included file with this function (GetPointCloudAtRoi()) or you may did some mistake in declaration. First check where GetPointCloudAtRoi() is then include this file. Next check where do you have your enum ESlRetrieveResult declaration include this one (if it’s another file) too.

Error you get is explict. Compiler can’t found definition for static enum ESlRetrieveResult. (Or GetPointCloudAtRoi())

According to Call another plugin's static function in my own plugin problem - C++ Programming - Unreal Engine Forums

you should add PublicDependencyModuleNames.Add(“OtherPluginModuleName”); to your plugin’s build.cs file.

What do you need two different plugins for? It’s not recomended.

If you will still have problem then comment please.

Hope this helps.

Hey,

Thanks for your reply. I fixed it, though it wasn´t what you and I thought it´d be.

First of all, it wasn´t a missing include. Because with a missing include, you dont get an unresolved external symbol, because the symbol itself cant be known then, so you would get a unkown identifier.

It also wasn´t a missing DependencyModule int the Build.cs, although I had experienced that modules aren´t always propagated through other modules.
(e.g. module1 adds dependency on module2, which has dependency on module3. If module1 also needs classes from module3, it needs to add it explicitly as dependency…)

At last it was a code failure. I use Visual Studio community 2017, which has a really bad IntelliSense performance, which is why I sometimes write the implementation of a method without the “generate method definition in cpp” functionality of Intellisense. And I forgot the class declaration UZEDFunctionLibrary:: before the GetPointCloudAtRoi(...) definition in the cpp file.

So the implementation of the method did not exist, which I did not recognize until I called it (if you dont call it, the compiler does not care whether a method has an implementation)^^

Hi! I had a similar problem, and in my case, I had all code correct, and the module name added to the .build file. I knew that should work, it did in another project, but I still have the unresolved external symbol error.

The problem was that the definition of the function (the body) was in the .cpp file, and in the other projects was in the .h file. Unreal required that, if the function was its body in the cpp file, the class must be marked as export and the macro NAMEOFMODULE_API must be added before the class declaration. In my case:

UCLASS()
class CORECOMMONTOOLS_API UCoreCommonToolsBPLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_UCLASS_BODY()
...
1 Like