Download

Edited AGamemode.h file and ended up with this error. Anyone know what causes this error?

I added in 3 new states at the top, then took out protected and made it public so i could use those function in the upper file. That is when these errors appeared and i can not seem to solve what is causing them.



1>C:\Program Files\Epic Games\UE_4.26Chaos\Engine\Source\Runtime\Engine\Classes\GameFramework/GameMode.h(38): error C2143: syntax error: missing ';' before '<class-head>'
1>C:\Program Files\Epic Games\UE_4.26Chaos\Engine\Source\Runtime\Engine\Classes\GameFramework/GameMode.h(38): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Epic Games\UE_4.26Chaos\Engine\Source\Runtime\Engine\Classes\GameFramework/GameMode.h(40): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int


Any ideas would be great.

At lines 38 and 40 is the code



UCLASS()
class ENGINE_API AGameMode : public AGameModeBase  //line 38
{
   GENERATED_UCLASS_BODY()   //line 40

    public://i added this and took out protected from below

};


You should show us all the code. The error suggests that you made a syntax mistake before the class definition.

here Is everything above UCLASS()



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

#pragma once

#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "Templates/SubclassOf.h"
#include "GameFramework/GameModeBase.h"
#include "GameMode.generated.h"

class APlayerState;
class ULocalMessage;
class UNetDriver;

/** Possible state of the current match, where a match is all the gameplay that happens on a single map */
namespace MatchState
{
extern ENGINE_API const FName EnteringMap; // We are entering this map, actors are not yet ticking
extern ENGINE_API const FName WaitingToStart; // Actors are ticking, but the match has not yet started
extern ENGINE_API const FName StateNone;//newly added
extern ENGINE_API const FName ChangingMaps;//newly added
extern ENGINE_API const FName RoundOver;//newly added
extern ENGINE_API const FName InProgress; // Normal gameplay is occurring. Specific games will have their own state machine inside this state
extern ENGINE_API const FName WaitingPostMatch; // Match has ended so we aren't accepting new players, but actors are still ticking
extern ENGINE_API const FName LeavingMap; // We are transitioning out of the map to another location
extern ENGINE_API const FName Aborted; // Match has failed due to network issues or other problems, cannot continue

// If a game needs to add additional states, you may need to override HasMatchStarted and HasMatchEnded to deal with the new states
// Do not add any states before WaitingToStart or after WaitingPostMatch
}

/*
* GameMode is a subclass of GameModeBase that behaves like a multiplayer match-based game.
* It has default behavior for picking spawn points and match state.
* If you want a simpler base, inherit from GameModeBase instead.
*/
UCLASS()


I just noticed that you probably not building from source. The path in your error message suggests that. If you just have the precompiled binaries you cannot modify engine source code. I’m kinda surprised that you get that error because the engine source should not even get compiled.

Yeah, if i change any code in source it asks if i want to over write the file and save it(1st time). Which i do because i want the added code. I’ve compiled other source stuff and it compiled fine and worked. I have run into something similar to this when trying to add to world.h and .cpp files. i finally gave up on adding to the world file. I cant add nothing to it, i get similar errors with that.

All i know is if you want a map rotation to work you must edit that file. I need it edited big time or i am just wasting my time here with this engine as you will not be making much of anything.

You don’t seem to understand the problem here. You cannot edit engine source code if you only have the binaries (meaning you downloaded the engine through the epic launcher). You have to build the whole engine from source to do what you want. Maybe refer to this https://docs.unrealengine.com/en-US/…ode/index.html

I don’t really know what you are trying to do but are you sure you can’t achieve it by just implementing your own GameMode class? It is very rare that you have to modify engine code.

Yeah i will just get rid of AGameMode and make my own from the base file. Thanks for that info on compiling the engine. I figured when i made changes in the engine and they took in the compile that it was all being compiled. Example; i added bools to physics volume they compiled up fine and are used np. I am doing the same with the GameModeBase file i added bool bTeam to it and it is used fine.

Anyways i think i see what you are saying



extern ENGINE_API const FName StateNone;//newly added
extern ENGINE_API const FName ChangingMaps;//newly added
extern ENGINE_API const FName RoundOver;//newly added


beings i am trying to compile this. It will not as i do not have right version to compile this > ENGINE_API

Thanks for your time and info much appreciated.