BlueprintImplementableEvent function definition changed

Having simple function in UObject.

UFUNCTION(BlueprintImplementableEvent,
Category = “AMQPConnect”, meta =
(ToolTip = “Fired when error occured.
After that connection will be
closed.”))

void OnError(const UAMQPAbstractConnection *connection,
const FString errorMessage);

Unreal Build tools generationg code:

void
UAMQPAbstractConnection::OnError(const
UAMQPAbstractConnection* connection,
const FString& errorMessage)

XCode writes error:

/Users//Dropbox/ST/Unreal/MyProject/Plugins/AMQPConnect/Intermediate/Build/Mac/UE4Editor/Inc/AMQPConnect/AMQPConnect.generated.cpp:14:32:
error: out-of-line definition of
‘OnError’ does not match any
declaration in
‘UAMQPAbstractConnection’

What i am doing wrong or it is a bug?

Ah its UBT generated code, If this really happens then this looks like bug i will move it to bug raports

Hey ,

Because I don’t know what UAMQPAbstractConnection is, I cannot test exactly what you are doing but I am not having any issues with this:

#pragma once

#include "Object.h"
#include "TUObject.generated.h"

UCLASS(BlueprintType)
class AH511778_API UTUObject : public UObject
{
	GENERATED_BODY()
	
public:

	UFUNCTION(BlueprintImplementableEvent, Category = "Test" )
	void OnError(FString &Test);
};

Please let me know if you have anymore information regarding your issue.

Thanks.

Please look at definition and on difference with generated code.
errorMessage in definition is not a reference, but in generated code it is refecence. If you compile that code with reference and try to extend class in blueprint - you will be surprised that errorMessage looks like return value, not as event parameter.

Decorate your string argument with a UPARAM macro, and make it a reference. This should make the errorMessage appear at the expected place in the BP editor. UHT doesn’t like exposing strings as values, but prefers references, which explains the first part of the problem. Undecorated references appear as return values by default, which explains the second part of the problem.

So, if you declare OnError like this instead:

UFUNCTION(BlueprintImplementableEvent, Category = "AMQPConnect", meta = (ToolTip = "Fired when error occured. After that connection will be closed."))
void OnError(const UAMQPAbstractConnection *connection, UPARAM(ref) const FString& errorMessage);

…everything should hopefully work out the way you want it.

Oh, I think I know what you mean.

When you use a BlueprintImplementableEvent, when you pass something in by reference, such as ( FString &Ref ), it will act as a return / out value. You can do this and it will be an argument:

UFUNCTION(BlueprintImplementableEvent, Category = "Tutorial")
void OnError( FName Test );

112460-511778_onerror.png