Play Sound Cue like in the Shooter game example

Actually it seems the problem was that I forgot to include “Sound/SoundCue.h”

Checking the Epic Shooter source I can clearly see that they are using SpawnSoundAttached to play a weapon sound.

UAudioComponent* AShooterWeapon::PlayWeaponSound(USoundCue* Sound)
{
	UAudioComponent* AC = NULL;
	if (Sound && MyPawn)
	{
		AC = UGameplayStatics::SpawnSoundAttached(Sound, MyPawn->GetRootComponent());
	}

	return AC;
}

I’m trying to play a sound in a very similar way, I do not need to keep track of the AudioComponent, but the rest of the code is exactly the same but I’m receiving an error saying that the two params that I’m passing cannnot be converted into the needed params.

void AWeaponBase::PlayWeaponSound()
{
     UGameplayStatics::SpawnSoundAttached(FireSound, RootComponent);
}

FireSound is SoundCue* exactly as for the Epic example. Could you kindly help me understsand what Iìm doing wrong?

/** .h /
/
* sound to play when … /
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = “Config”, meta = (AllowPrivateAccess = “true”))
class USoundBase
FireSound;

/** .cpp  */
/**   */
#include "Kismet/GameplayStatics.h"
UGameplayStatics::PlaySoundAtLocation(this, FireSound, GetActorLocation());
UGameplayStatics::PlaySound2D(this, FireSound);

try this way. don’t forget to set FireSound in BP

Stupid question sorry.
I forgot to include “Sound/SoundCue.h”