C++ 4.7.5 ChoosePlayerStart code doesn't work

Hi all,

I’m borrowing the ChoosePlayerStart functionality (with some modification) from the Shooter demo project and I’m getting some really annoying compile errors. One is an error when attempting to cast TestSpawn (a APlayerStart actor) to APlayerStartPIE actor. The other error is attempting to return the BestStart acor fails due to it not being a suitable conversion (no conversion from ‘AActor *’ to ‘APlayerStart *’). Any ideas?

Below is the code and I’ve put problem lines in bold:

h.
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/GameMode.h"
#include "TestNetworkProjectGameMode.generated.h"

UCLASS(minimalapi)
class ATestNetworkProjectGameMode : public AGameMode
{
	GENERATED_BODY()	

		/** Override default game logic to start at first spawn. 
               * Instead we'll be choosing the best start location for each new player. */
		virtual bool ShouldSpawnAtStartSpot(AController* Controller) override;

		/** Choose the best start location for new players. */
		virtual AActor* ChoosePlayerStart(AController* Player) override;
public:
	ATestNetworkProjectGameMode(const FObjectInitializer& ObjectInitializer);
};


.cpp
#include "TestNetowkrProjectGameMode.h"
// Also other various includes.

AActor* ATestNetworkProjectGameMode::ChoosePlayerStart(AController* Player)
{
	APlayerStart* BestStart = NULL;

	/* Loop through all map's available player starts, 
       * selecting the "best" one for this player. */
	for(int32 iCntr = 0; iCntr < PlayerStarts.Num(); iCntr++)
	{
		APlayerStart* TestSpawn = PlayerStarts[iCntr];

               /* The following IF statement throws compile error C2065 
                * and C2974 'APlayerStartPIE' : 
                * undeclared identifier and 'Cast' : Invalid template  argument 
                *  for 'T", type expected. */
		if (Cast<APlayerStartPIE>(TestSpawn) != NULL) 
		{
			// Always use the first "play from here" test spawn if in PIE.
			BestStart = TestSpawn;
			break;
		}
		else if(TestSpawn != NULL) // We must be in a real game, look for available starts.
		{
			if(BestStart == NULL)
			{
				BestStart = PlayerStarts[FMath::RandHelper(PlayerStarts.Num())];
			}
		}
	}
	return BestStart ? BestStart : Super::ChoosePlayerStart(Player); // Throws compile error C2446: ':' no conversion from 'AActor *' to 'APlayerStart *'
}

Any input or suggestions would be most appreciated.

Cheers,

FIX:

include Engine.h (not EngineMinimal.h in the project base header file).