UE5.3 - Compile error in BlackboardKey.h when compiling a class inheriting from UBTTaskNode

I’ve been stuck a few days on this: I created the new class through the editor and without adding any new code, I get the following error:

1>[1/5] Compile [x64] TTBTask_RangedAttack.gen.cpp
1>C:\Dev\UE_5.3\Engine\Source\Runtime\AIModule\Classes\BehaviorTree\Blackboard\BlackboardKey.h(7): error C2143: syntax error: missing ';' before 'namespace'
1>C:\Dev\UE_5.3\Engine\Source\Runtime\AIModule\Classes\BehaviorTree\Blackboard\BlackboardKey.h(7): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>[2/5] Compile [x64] TTBTask_RangedAttack.cpp
1>C:\Dev\UE_5.3\Engine\Source\Runtime\AIModule\Classes\BehaviorTree\Blackboard\BlackboardKey.h(7): error C2143: syntax error: missing ';' before 'namespace'
1>C:\Dev\UE_5.3\Engine\Source\Runtime\AIModule\Classes\BehaviorTree\Blackboard\BlackboardKey.h(7): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>Total time in Parallel executor: 2.40 seconds

The class header

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "BehaviorTree/BTTaskNode.h"
#include "TTBTask_RangedAttack.generated.h"

/**
 * 
 */
UCLASS()
class TTPROJ_API UTTBTask_RangedAttack : public UBTTaskNode
{
	GENERATED_BODY()
	
};

the source file

// Fill out your copyright notice in the Description page of Project Settings.


#include "AI/TTBTask_RangedAttack.h"

As a note, I’ve already done my own Behaviour Tree service and it compiles/links fine.

Thanks in advance !

I just encountered the same problem, and I found the cause of the problem.

It may be too late a reply because it’s two years from your question, but I’m adding for others who will face the same problem one day.

If you accidentally erase and rewrite a portion of the annotation that goes in automatically when you create a C++ file in the Unreal Engine, the problem can occur because the encoding is different.

Therefore, erasing or rewriting the corresponding comment (first line) is the solution.

Please understand that the answer may be awkward because I used a translator.