UFunction causing other compilation error

UFUNCTION(BlueprintCallable, Category = “CabinetParts”)
void GenerateBaseCabinetSide(UProceduralMeshComponent* mesh, float cabHeight, float CabDepth, float panelThickness, float toeKickHeight, float toeKickDepth, bool generateCollision);

Commenting out the Ufunction line and everything compiles fine, But I can’t access my function in blueprint.

If you have error please paste it here, otherwise nobody will know whats going on

Other compilation error is the message that’s displayed. I have other similar classes in the same project that work fine and without a more informative error message I’m having trouble nailing down the issue with this one.

Hey -

If you go to the Output window in Visual Studio it should give a bit more information to what the compilation error is. Could you post the results from the Output log when the build fails and you receive that message?

Cheers

Error 1 error code: OtherCompilationError (5) C:\Users\Steve\Documents\Unreal Projects\Procedural_Furniture\Intermediate\ProjectFiles\Error Procedural_Furniture

Error 2 error MSB3073: The command ““C:\Program Files\Unreal Engine\4.8\Engine\Build\BatchFiles\Build.bat” Procedural_FurnitureEditor Win64 Development “C:\Users\Steve\Documents\Unreal Projects\Procedural_Furniture\Procedural_Furniture.uproject” -rocket” exited with code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 38 5 Procedural_Furniture

If I comment out the UFunction line it compiles fine.

You sure this from output tab?

Hey -

Your post seems to be from the Error List rather than the Output tab of Visual Studio. If this is the case can you make sure you are on the Output tab and let me know what it says? Currently my best guess as to what may be causing the problem would be to make sure that the function is declared inside a “public:” section of your class header.

It was something to do with that particular function. Deleting it and using the UFunction macro on another function works just fine.

Hey -

Using BlueprintCallable along with a Category is what allows the function to be called inside of blueprints. If you are not using the function in blueprints then the UFUNCTION() macro is not necessary. If you are using the function in blueprints and are still getting the “Other Compilation Errors” message then please include the information from the Output Tab in Visual Studio after a failed compile to give a better idea of what the exact error is.

Cheers

i am currently having the same issue

Hey

Can you post what the Output log in Visual Studio says the Other Compilation Error is? This will help point to what needs to be changed for the code to compile properly.

1>ERROR : UBT error : Failed to produce item: C:\Users\PorterN3\Documents\Unreal Protype\Prototype3\Prototype2\Binaries\Win64\UE4Editor-Prototype2-6126.dll
1> Total build time: 7.80 seconds
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ““C:\Program Files\Epic Games\4.8\Engine\Build\BatchFiles\Build.bat” Prototype2Editor Win64 Development “C:\Users\PorterN3\Documents\Unreal Protype\Prototype3\Prototype2\Prototype2.uproject” -rocket” exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========

1>C:\Users\PorterN3\Documents\Unreal Protype\Prototype3\Prototype2\Source\Prototype2\Private\PlayerClass.cpp(15): error C2511: ‘void UPlayerClass::ImportPic_Implementation(FString)’ : overloaded member function not found in ‘UPlayerClass’
1> C:\Users\PorterN3\Documents\Unreal Protype\Prototype3\Prototype2\Source\Prototype2\Public\PlayerClass.h(10) : see declaration of ‘UPlayerClass’
1>C:\Users\PorterN3\Documents\Unreal Protype\Prototype3\Prototype2\Intermediate\Build\Win64\UE4Editor\Inc\Prototype2\Prototype2.generated.cpp(13): error C2511: ‘void UPlayerClass::ImportPic(const FString &)’ : overloaded member function not found in ‘UPlayerClass’
1> C:\Users\PorterN3\Documents\Unreal Protype\Prototype3\Prototype2\Source\Prototype2\Public/PlayerClass.h(10) : see declaration of ‘UPlayerClass’
1>C:\Users\PorterN3\Documents\Unreal Protype\Prototype3\Prototype2\Intermediate\Build\Win64\UE4Editor\Inc\Prototype2\Prototype2.generated.cpp(16): error C2352: ‘UObject::FindFunctionChecked’ : illegal call of non-static member function
1> c:\program files\epic games\4.8\engine\source\runtime\coreuobject\public\uobject\UObject.h(753) : see declaration of ‘UObject::FindFunctionChecked’

Hey

Based on the error message it is most likely that you are attempting to override a function (PlayerClass::ImportPic) that is not marked as virtual in its parent class or the signature of your override function does not match the signature of the parent function.

I changed it to static and it worked
although now I can’t get the class to show up in blueprints

nvm figured that out
I didn’t know that UObject defaulted to not blueprintable

I’m thinking this error might have happened because you declared the property before setting the section to public.

Instead of doing this

UCLASS()
class QUICKSTART_API AMyActor : public AActor
{
	GENERATED_BODY()
		UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage")
		int32 TotalDamage;

public:	
	// Sets default values for this actor's properties
	AMyActor();

        ...
};

Try this:

    UCLASS()
    class QUICKSTART_API AMyActor : public AActor
    {
    	GENERATED_BODY()
    
    public:	
    	// Sets default values for this actor's properties
    	AMyActor();

    	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage")
    		int32 TotalDamage;
            ...
    };

This is most likely what had happened and the correct solution.

I was running into the same issue, and this fixed it. Thank you!