EditorApplySpline is not accessible via C++

When porting the Blueprint code to c++ I get a linker error. I have included:

#include “Runtime/Landscape/Classes/LandscapeProxy.h”

1>CityPathBuilder.cpp.obj : error LNK2001: unresolved external symbol "public: void __cdecl ALandscapeProxy::EditorApplySpline(class USplineComponent *,float,float,float,float,float,float,int,bool,bool,class ULandscapeLayerInfoObject *)" (?EditorApplySpline@ALandscapeProxy@@QEAAXPEAVUSplineComponent@@MMMMMMH_N1PEAVULandscapeLayerInfoObject@@@Z)

Hi Shoiko,

I’m afraid I can’t exactly tell what the problem is from the information provided. Could you provide me with more context, as in the code files that you are using or the entire project itself if possible. If you wish to upload the project but can’t fit the file on the Answerhub, please feel free to upload it to a third-party site such as DropBox.

Header:

 #pragma once
    #include "Classes/Components/SplineComponent.h"
    #include "Runtime/Engine/Classes/Components/SplineMeshComponent.h"
    #include "Runtime/Landscape/Classes/LandscapeProxy.h"
    #include "BuildingModGen.h"
    #include "GameFramework/Actor.h"
    #include <string>
    #include <vector>
    #include <iostream>
    #include <fstream>
 
    #include <windows.h>
    #include <conio.h>
    #include "CityPathBuilder.generated.h"
    
    using namespace std;
    
    UCLASS()
    class RPGSYSTEM_DEMO_API ACityPathBuilder : public AActor
    {
    	GENERATED_BODY()
    	
    public:	
    	
    	UPROPERTY()
    		USplineComponent * PathRoot;
    	UPROPERTY()
    		USplineComponent* _LSpline;
    	UPROPERTY()
    		USplineComponent* _RSpline;
    
    	UFUNCTION(BlueprintCallable, Category = "CityPath")
    		void UpdateBuildingTerrain();
    
    
    
    };


CPP File: 


#include "RPGSystem_Demo.h"
#include "CityPathBuilder.h"

#include "Runtime/Landscape/Classes/Landscape.h"

void ACityPathBuilder::UpdateBuildingTerrain(){
	if (TerrTarget != nullptr){
		UE_LOG(LogTemp, Log, TEXT("ACityPathBuilder:TerrTarget is not set, please set."));
		return;
	}
	ALandscapeProxy::EditorApplySpline
	if (_RSpline != nullptr){
		TerrTarget->EditorApplySpline(_RSpline, BuildingTerrWidth, BuildingTerrWidth, BuildingTerrFalloff, BuildingTerrFalloff);
	}

	if (_LSpline != nullptr){
		TerrTarget->EditorApplySpline(_LSpline, BuildingTerrWidth, BuildingTerrWidth, BuildingTerrFalloff, BuildingTerrFalloff);
	}

	if (PathRoot != nullptr){
		TerrTarget->EditorApplySpline(PathRoot, BuildingTerrWidth, BuildingTerrWidth, BuildingTerrFalloff, BuildingTerrFalloff);
	}
}

I looked into the Landscape proxy and I see the function, it is public and I do see that the cpp file with the function declared is in a seperate cpp file. But the linker is still tossing an error for that function.

Have you come across this error before?

Error 1 error C1083: Cannot open include file: ‘LandscapeInfo.generated.h’: No such file or directory

If so, how were you able to bypass it? Or is this error still occurring as well?

I’ve seen it that usually happens when there is another include missing. I can just recreate the issues in a full project and upload it.

That would be very helpful. Having the entire project and being able to run it through the compiler helps a lot.

I was wrong before that error happened because you were missing the correct module for the Headers used. You need the Landscape module for those header files. Here is the project:

opps i meant to apply the files as a reply. I don’t knoiw how you all get notifications on your side.

I’ve found the issue and there are two ways to get around it.

The issue is that the class that the function is in has the specifier ‘MinimalAPI’ which makes it where you can cast to the class, but none of its functions are available publicly. This is used to improved compile times, but you can remove the specifier yourself if you use the source version of the engine instead of the binary. The documentation page is limited, but here it is for MinimalAPI.

https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Classes/Specifiers/MinimalAPI/index.html

The only other way I can think of to get around it would be to make the function Inline, which if you’re not familiar with it, this is a feature of Visual C++ and you can find more information about that method at the following link:

I hope this helps and that you have a great day

Will this ever be fully available to C++ without engine modification?

Not that I am aware of. It was done to improve compile times as it isn’t commonly called. It should be an easy modification however, or you could use Inline which would also make your code file larger but would avoid needing to modify the engine itself.

Is there anyway to do it without getting access to the GIT code? I’m mainly using it in a tool for others to use for environment design. Not everyone has the knowledge to use the GIT. For now I am calling the function via blueprint script. So that’s my workaround for now. Would be nice if they added it to c++.

Inline is a feature of C++ itself. It doesn’t involve changing the source code files and it’s the only thing I can suggest that would help you in this situation.

Maybe I read this wrong. Where does the inline statement go. Can I get a post of the implementation? I thought you meant for me to modify the LandscapeProxy class. and inline the EditorApplySpline function into the header of said file. Are you saying to inline the function into my project files in the header?

The confusion was on my side. I was misunderstanding the implementation of the inline function. You’re correct that it would have to be specific at the time of declaration. Unfortunately, without that method, blueprints would be the best option to access these if you wish to avoid editing the source code. It is by design that these functions are unavailable in c++ without editing the source code.

's answer did not work in my case.

But the following does:

In LandscapeProxy.h add LANDSCAPE_API in front of the declaration of EditorApplySpline and include the Landscape Module in your Build.cs.