Class extending base dont want to compile

Help me please. I cant understand why builder exiting with error.
I have two classes. One is base class, that extend UObject. This class compiles fine and without any errors.

#include "Object.h"
#include "AMQPConnectionFactory.h"
#include "AMQPAbstractConnection.generated.h"


UCLASS(Abstract)
class AMQPCONNECT_API UAMQPAbstractConnection : public UObject {
    GENERATED_BODY()

public:
    UAMQPAbstractConnection();
    ~UAMQPAbstractConnection();


    UFUNCTION(BlueprintCallable, Category = "AMQPConnect", meta = (ToolTip = "connect producer to broker", ExpandEnumAsExecs = "Branches"))
    void connect(FString host, int32 port, FString login, FString password, EConnectionResultBranch &Branches);

Another class is extending base class

#include "AMQPAbstractConnection.h"
#include "AMQPProducerConnection.generated.h"


UCLASS(Blueprintable)
class AMQPCONNECT_API UAMQPProducerConnection : public UAMQPAbstractConnection {
    GENERATED_BODY()

public:
    UAMQPProducerConnection();

    ~UAMQPProducerConnection();


    UFUNCTION(BlueprintCallable, Category = "AMQPConnect", meta = (ToolTip = "send message to broker"))

    void sendMessage(FString exchangeName, UAMQPMessage *message);

Build scripts throws error

/Users//Dropbox/ST/Unreal/MyProject/Plugins/AMQPConnect/Source/AMQPConnect/Public/AMQPProducerConnection.h(9) : 'AMQPProducerConnection' can't be compiled: Parent class 'AMQPAbstractConnection' has errors
Error: Failed to generate code for MyProjectEditor - error code: OtherCompilationError (5)

If i will remove interhitance from second object - all compiles fine.
Can anyone tell me what this error means and where is error in base class?

Help me please!

Hey Mirackle-

When I copy the code provided into classes I am able to compile without any error. Are you able to reproduce this behavior in a new, clean project? If so, please include the setup steps that lead to this occurring to help me test on my end.

Hi ! Today I had next problem - It was imposible for me to create a Key class based on AActor … And I Created DoorKey class with success.

It seems a wrong topic :slight_smile:

I can send you plugin source that you can test. I just right now created new example project, moved plugin sources to it and have same result.

Give me your email please.

If you’re able to upload the source to google drive / dropbox you can send me a PM on the forums with the download link.

I sent you message in forums.

, can you look on it?

I am still cant understand why this error is occurred. Yes, iam C++ newbee, i am java man. But in any language one class can extend another class. And there is no errors from compiler or IDE. Only critical error from unreal build tools.

I would be grateful for any help.

UE4 uses a lot of macros, so errors generated by the compiler or IDE can be very misleading. Within Visual Studio it’s much better to use the Output tab, rather than the Error tab to get compile results.

I don’t know why your classes work now (assuming they do) and did not before, but if you post the before and after source files so we can see what changes were made we might be able to let you know what the problem was.

Hey Mirackle-

After reviewing the files you sent, I noticed there was a circular dependence issue in your include statements. AMQPProducerConnection.h has an include for AMQPAbstractConnection.h - AMQPAbstractConnection.h has an include for AMQPConnectionFactory.h - and AMQPConnectionFactory.h has an include for AMQPProducerConnection.h.

I also noticed circular dependency between AMQPConsumerConnection including AMQPAbstractConnection , AMQPAbstractConnection including AMQPConnectionFactory , and AMQPConnectionFactory including AMQPConsumerConnection.

This is likely the reason for compile issues when you add the inheritance. The simplest solution would be to forward declare the class as necessary inside the child. This should allow you to use the functions from your “parent” class and still allow the code to compile.

Cheers

Thank you very much for a fresh look. It is now fixed. But there is “pragma once” in each .h, and it must not create loops. Anyway thank you!