AGameModeBase::StartPlay() Error- error C2653: 'AReviseGameModeBase': is not a class or namespace name

Hello Friends,
I am An Born 2 Month Child in UE4 Exp Basically Begineer
I Was Getting This Following Error -

1>------ Skipped Build: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
1>Project not selected to build for this solution configuration
2>------ Build started: Project: Revise, Configuration: Development_Editor x64 ------
2>Building ReviseEditor…
2>Using Visual Studio 2019 14.29.30138 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133) and Windows 10.0.19041.0 SDK (C:\Program Files (x86)\Windows Kits\10).
2>Building 4 actions with 4 processes…
2> [1/4] ReviseGameMode.cpp
2>D:\Unreal Projext\Revise\Source\Revise\ReviseGameMode.cpp(19): error C2653: ‘AReviseGameModeBase’: is not a class or namespace name
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(45,5): error MSB3073: The command ““D:\Epic Games Stored\VALORANT\UE_4.27\Engine\Build\BatchFiles\Build.bat” ReviseEditor Win64 Development -Project=“D:\Unreal Projext\Revise\Revise.uproject” -WaitMutex -FromMsBuild” exited with code 6.
2>Done building project “Revise.vcxproj” – FAILED.

My .Cpp File

// Copyright Epic Games, Inc. All Rights Reserved.

#include "ReviseGameMode.h"
#include "ReviseCharacter.h"
#include "UObject/ConstructorHelpers.h"
#include "GameFramework/GameModeBase.h"

AReviseGameMode::AReviseGameMode()
{
	// set default pawn class to our Blueprinted character
	static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("/Game/ThirdPersonCPP/Blueprints/ThirdPersonCharacter"));
	if (PlayerPawnBPClass.Class != NULL)
	{
		DefaultPawnClass = PlayerPawnBPClass.Class;
	}
	
}

void AReviseGameModeBase namespace:: StartPlay()
{
	check(GEngine != nullptr);

	//Display a debug message for five seconds.
	//The -1 "Key" value argument prevents the message from being updated or refreshed
	GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Yellow, TEXT("Hello World,this is FPSGameMode!"));
}


**My .h**

#pragma once

#include “CoreMinimal.h”
#include “GameFramework/GameModeBase.h”
#include “ReviseGameMode.generated.h”

UCLASS(minimalapi)
class AReviseGameMode : public AGameModeBase
{
GENERATED_BODY()

public:
AReviseGameMode();
};


I am  Following This Document -
[https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/CPPTutorials/FirstPersonShooter/1/](https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/CPPTutorials/FirstPersonShooter/1/)
void AReviseGameModeBase namespace:: StartPlay()

What is the “namespace::” doing there?

Yea, get rid of the namespace stuff. Your original problem is probably from the mixing of the class name AReviseGameMode and AReviseGameModeBase

Make sure you use the same name you used when declaring the class in the header.
In this case AReviseGameMode, NOT AReviseGameModeBase.

HTH

1 Like