Enviromental Query Link error

Hello! I’m trying to set up an EQS to get some spawning points but for some reason I’m getting linking errors even if I’m only defining the variable.

the .h looks like this

#pragma once

#include "CoreMinimal.h"
#include "EnvironmentQuery/EnvQuery.h"
#include "GameFramework/GameModeBase.h"
#include "Letters/WsBaseLetter.h"
#include "WsCollectLettersGameModeBase.generated.h"

/**
 * 
 */
UCLASS()
class SNAKEWORDPROJECT_API AWsCollectLettersGameModeBase : public AGameModeBase
{
	GENERATED_BODY()

protected:
	virtual void BeginPlay() override;

	UPROPERTY(EditAnywhere, Category="Game settings")
	float GameDuration;
	UPROPERTY(EditAnywhere, Category="Game settings")
	float LetterSpawnCooldown;
	UPROPERTY(EditAnywhere, Category="Game settings")
	int MaxLettersInScreen;
	
	UPROPERTY(EditDefaultsOnly, Category = "Game settings")
	TSubclassOf<AActor> BaseLetter;
	UPROPERTY(EditDefaultsOnly, Category="Game settings")
	UEnvQuery* SpawnLetterQuery;
	
	UPROPERTY(BlueprintReadWrite)
	FTimerHandle MainGameTimerHandle;
	
	UPROPERTY(BlueprintReadWrite)
	FTimerHandle LetterSpawnTimerHandle;
	
	UFUNCTION()
	void OnGameTimerEnded();
	
	UFUNCTION()
	void OnSpawnLetterTimerEnded();
	
	// UFUNCTION()
	// void OnSpawnLettersQueryCompleted(UEnvQueryInstanceBlueprintWrapper* QueryInstance, EEnvQueryStatus::Type QueryStatus);
};

And the .cpp (where no EQS is being used yet)


#include "WsCollectLettersGameModeBase.h"
#include "Kismet/GameplayStatics.h"

void AWsCollectLettersGameModeBase::BeginPlay()
{
	Super::BeginPlay();
	
	GetWorld()->GetTimerManager().SetTimer(MainGameTimerHandle, this,
		&AWsCollectLettersGameModeBase::OnGameTimerEnded, GameDuration, false);
	
	GetWorld()->GetTimerManager().SetTimer(LetterSpawnTimerHandle, this,
	&AWsCollectLettersGameModeBase::OnSpawnLetterTimerEnded, LetterSpawnCooldown, true);
}

void AWsCollectLettersGameModeBase::OnGameTimerEnded()
{
	UGameplayStatics::OpenLevel(GetWorld(), FName(TEXT("ArrangeLettersGame")));
}

void AWsCollectLettersGameModeBase::OnSpawnLetterTimerEnded()
{
	// UEnvQueryInstanceBlueprintWrapper* QueryLetterInstance = UEnvQueryManager::RunEQSQuery(this,
	// 	SpawnLetterQuery, this, EEnvQueryRunMode::AllMatching, nullptr);
	//
	// if(ensure(QueryLetterInstance))
	// {
	// 	QueryLetterInstance->GetOnQueryFinishedEvent().AddDynamic(this,
	// 		&AWsCollectLettersGameModeBase::OnSpawnLettersQueryCompleted);
	// }
}

the error looks like this (I’m sorry I dont know how to change the error log to english)

  LNK2019: símbolo externo "__declspec(dllimport) class UClass * __cdecl Z_Construct_UClass_UEnvQuery_NoRegister(void)" (__imp_?Z_Construct_UClass_UEnvQuery_NoRegister@@YAPEAVUClass@@XZ) sin resolver al que se hace referencia en la función "void __cdecl `dynamic initializer for 'public: static struct UECodeGen_Private::FObjectPropertyParams const Z_Construct_UClass_AWsCollectLettersGameModeBase_Statics::NewProp_SpawnLetterQuery''(void)" (??__E?NewProp_SpawnLetterQuery@Z_Construct_UClass_AWsCollectLettersGameModeBase_Statics@@2UFObjectPropertyParams@UECodeGen_Private@@B@@YAXXZ)

  UnrealEditor-SnakeWordProject.dll: LNK1120: 1 externos sin resolver

Any thoughts? thanks!

So I found out why that was happening, first for all the begginers like me its good to understand what a LINK error means (please someone correct me if I’m wrong) but it means that you are trynig to use something that is not defined inside the project, so it basically doesn’t know what it means.

To fix this specific error you need to add to the .build.cs file the “AIModule” to the PublicDependencyModuleNames, in my case it now looks like this:

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "AIModule" });