Linux KDevelop Autocomplete Errors

I am using the built-in KDevelop plugin for Unreal Engine to edit c++ code. However, Intellisense is producing strange preprocessing errors. The code is simply the default template code:
#pragma once

#include "GameFramework/Actor.h"
#include "TestActor.generated.h"

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

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;	
};

The errors are as follows:

TestActor.generated.h not found

Unexpected token ‘class’

(on public AActor) constant expression expected

(on the first brace) Unexpected token ‘{’

In the .cpp file, Intellisense is saying none of the functions have been declared, which is probably a side result from the header not being interpreted correctly.

I have copied the contents of [ProjectName]Defines.pri and [ProjectName]Includes.pri into their appropriate location, which eliminates a couple of errors, but leaves the ones listed above. I have tried installing the eclipse plugin, but compiling it results in a compile error. I would prefer to get this working instead. What might be going wrong?

Intellisense in KDevlop?

Yes, it is marking errors with spell-check style lines. I think it is called intellisense, I am new to using KDevelop, I have used eclipse in the past. The code compiles fine inside of Unreal Engine.

Ah so you mean errors while you edit, intellisense is a name of this system in VS… but only VS, so don’t use in anything other then VS as it may confuse people ^^’

Plugin won’t configure KDevlop for you, you should configure it yourself. First try if it builds with those errors, VS also have problem as it is not fully compatible with UBT and UHT hackish macros, it should build anyway, if it not that means it really problem in your code (i hope you set up KDevlop to use UBT). Try set paths correctly in project settings, if nothing helps then either ignore or disable this feature.

ah, ok. Is there any particular term I should use instead?

I have put in the includes and defines from the generated files, which got rid of some of the errors. However, since KDevelop does not recognize the UCLASS() macro, it does not recognize the class token and hence cannot process what is inside the class. Because of that, I cannot use the autocomplete to remember names of functions for variables inside the class. I would rather have the autocomplete working at least for that, so I don’t have to look for spelling mistakes.

I did not know it was possible to set up building from KDevelop, could you give a link on how to do that?

Thank you for helping me with this problem!

Hi there,

I have managed to resolve this issue by appending ; to the UCLASS macro at ObjectBase.h like:

#if UE_BUILD_DOCS
#define UCLASS(…);
#else
#define UCLASS(…) BODY_MACRO_COMBINE(CURRENT_FILE_ID,_,LINE,_PROLOG);
#endif

This way the linter at KDevelop wont messe things up!