x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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/bazenafrolova/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?

Product Version: UE 4.13
Tags:
more ▼

asked Oct 09 '16 at 08:36 PM in C++ Programming

avatar image

Mirackle
1 4 5

avatar image Mirackle Oct 11 '16 at 04:54 PM

Help me please!

avatar image Doug E ♦♦ STAFF Oct 12 '16 at 04:16 PM

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.

avatar image Mirackle Oct 12 '16 at 04:39 PM

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.

avatar image Mirackle Oct 12 '16 at 04:42 PM

Give me your email please.

avatar image NoCodeBugsFree Oct 12 '16 at 04:28 PM

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.

avatar image Mirackle Oct 12 '16 at 04:32 PM

It seems a wrong topic :-)

avatar image Doug E ♦♦ STAFF Oct 12 '16 at 05:04 PM

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.

avatar image Mirackle Oct 12 '16 at 05:46 PM

I sent you message in forums.

avatar image Mirackle Oct 13 '16 at 04:29 PM

Doug Wilson, can you look on it?

avatar image Mirackle Oct 15 '16 at 11:32 PM

I am still can`t understand why this error is occurred. Yes, i`am 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.

avatar image GigasightMedia Oct 16 '16 at 09:36 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

Doug Wilson

more ▼

answered Oct 17 '16 at 02:12 PM

avatar image Mirackle Oct 17 '16 at 02:57 PM

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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question