Error in CharacterMovementReplication.generated.h

Error:
Severity Code Description Project File Line Suppression State
Error MSB3073 The command “D:\Programs\unreal\UE_4.26\Engine\Build\BatchFiles\Build.bat OpHellEditor Win64 Development -Project=“blah blah OpHell.uproject” -WaitMutex -FromMsBuild” exited with code 6. OpHell C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets 45
Error C2143 syntax error: missing ‘;’ before ‘‘template<’’ OpHell D:\Programs\unreal\UE_4.26\Engine\Intermediate\Build\Win64\UE4Editor\Inc\Engine\CharacterMovementReplication.generated.h 22
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int OpHell D:\Programs\unreal\UE_4.26\Engine\Intermediate\Build\Win64\UE4Editor\Inc\Engine\CharacterMovementReplication.generated.h 22

Output:
Build started…
1>------ Build started: Project: OpHell, Configuration: Development_Editor x64 ------
2>------ Skipped Build: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>Project not selected to build for this solution configuration
1>Creating makefile for OpHellEditor (game project files are newer)
1>Parsing headers for OpHellEditor
1> Running UnrealHeaderTool “C:\Users\suvik\lovelyhome\ue4\OpHell\OpHell.uproject” “C:\Users\suvik\lovelyhome\ue4\OpHell\Intermediate\Build\Win64\OpHellEditor\Development\OpHellEditor.uhtmanifest” -LogCmds=“loginit warning, logexit warning, logdatabase error” -Unattended -WarningsAsErrors -abslog=“C:\Users\suvik\AppData\Local\UnrealBuildTool\Log_UHT.txt” -installed
1>Reflection code generated for OpHellEditor in 48.223026 seconds
1>Building OpHellEditor…
1>Using Visual Studio 2019 14.28.29335 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333) and Windows 10.0.18362.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>Building 5 actions with 4 processes…
1> [1/5] OH_Character.cpp
1>D:\Programs\unreal\UE_4.26\Engine\Intermediate\Build\Win64\UE4Editor\Inc\Engine\CharacterMovementReplication.generated.h(22): error C2143: syntax error: missing ‘;’ before ‘‘template<’’
1>D:\Programs\unreal\UE_4.26\Engine\Intermediate\Build\Win64\UE4Editor\Inc\Engine\CharacterMovementReplication.generated.h(22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1> [2/5] OH_Character.gen.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(45,5): error MSB3073: The command “D:\Programs\unreal\UE_4.26\Engine\Build\BatchFiles\Build.bat OpHellEditor Win64 Development -Project=“C:\Users\suvik\lovelyhome\ue4\OpHell\OpHell.uproject” -WaitMutex -FromMsBuild” exited with code 6.
1>Done building project “OpHell.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========

OH_Character.h
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include “CoreMinimal.h”
#include “GameFramework/Character.h”
#include “OH_Character.generated.h”

UCLASS()
class OPHELL_API AOH_Character : public ACharacter
{
GENERATED_BODY()

public:
// Sets default values for this character’s properties
AOH_Character();

protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;

public:
// Called every frame
virtual void Tick(float DeltaTime) override;

// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

private:
//INPUT FUNCTIONS
UFUNCTION()
void MoveForward(float Value);
UFUNCTION()
void MoveRight(float Value);

};


OH_Character.cpp

ing// Fill out your copyright notice in the Description page of Project Settings.

#include “OH_Character.h”

// Sets default values
AOH_Character::AOH_Character()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don’t need it.
PrimaryActorTick.bCanEverTick = true;

}

// Called when the game starts or when spawned
void AOH_Character::BeginPlay()
{
Super::BeginPlay();

}

// Called every frame
void AOH_Character::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);

}

// Called to bind functionality to input
void AOH_Character::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);

//Bind Axis
PlayerInputComponent->BindAxis(“MoveForward”, this, &AOH_Character::MoveForward);
PlayerInputComponent->BindAxis(“MoveRight”, this, &AOH_Character::MoveRight);

//Bind Action
PlayerInputComponent->BindAction(“Jump”, IE_Pressed, this, &ACharacter::Jump);
PlayerInputComponent->BindAction(“Jump”, IE_Released, this, &ACharacter::StopJumping);
}

void AOH_Character::MoveForward(float Value)
{
FVector Direction = FRotationMatrix(GetActorRotation()).GetScaledAxis(EAxis::X);
AddMovementInput(Direction, Value);
}

void AOH_Character::MoveRight(float Value)
{
FVector Direction = FRotationMatrix(GetActorRotation()).GetScaledAxis(EAxis::Y);
AddMovementInput(Direction, Value);
}

Error in is in generated files…any help is appreciated.

I don’t see anything wrong with your code. Have you modified other files? The error comes from an engine source, maybe show us the file (CharacterMovementReplication.generated.h). There shouldn’t be a syntax error in there.

// Copyright Epic Games, Inc. All Rights Reserved.
/===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================
/

#include “UObject/ObjectMacros.h”
#include “UObject/ScriptMacros.h”

PRAGMA_DISABLE_DEPRECATION_WARNINGS
#ifdef ENGINE_CharacterMovementReplication_generated_h
#error “CharacterMovementReplication.generated.h already included, missing ‘#pragma once’ in CharacterMovementReplication.h”
#endif
#define ENGINE_CharacterMovementReplication_generated_h

#define Engine_Source_Runtime_Engine_Classes_GameFramework_CharacterMovementReplication_h_332_GENERATED_BODY
friend struct Z_Construct_UScriptStruct_FCharacterMoveResponsePackedBits_Statics;
static class UScriptStruct* StaticStruct();
typedef FCharacterNetworkSerializationPackedBits Super;

template<> ENGINE_API UScriptStruct* StaticStruct<struct FCharacterMoveResponsePackedBits>();

#define Engine_Source_Runtime_Engine_Classes_GameFramework_CharacterMovementReplication_h_223_GENERATED_BODY
friend struct Z_Construct_UScriptStruct_FCharacterServerMovePackedBits_Statics;
static class UScriptStruct* StaticStruct();
typedef FCharacterNetworkSerializationPackedBits Super;

template<> ENGINE_API UScriptStruct* StaticStruct<struct FCharacterServerMovePackedBits>();

#define Engine_Source_Runtime_Engine_Classes_GameFramework_CharacterMovementReplication_h_41_GENERATED_BODY
friend struct Z_Construct_UScriptStruct_FCharacterNetworkSerializationPackedBits_Statics;
static class UScriptStruct* StaticStruct();

template<> ENGINE_API UScriptStruct* StaticStruct<struct FCharacterNetworkSerializationPackedBits>();

#undef CURRENT_FILE_ID
#define CURRENT_FILE_ID Engine_Source_Runtime_Engine_Classes_GameFramework_CharacterMovementReplication_h

PRAGMA_ENABLE_DEPRECATION_WARNINGS


c++ - Missing ';' before 'template<' - Stack Overflow – this could be useful.

Unless you have modified that file and are building from source the problem is most likely not in the engine files, don’t know what I was thinking. The problem must be in some other file that you have modified/created. UE has a lot of macro magic going on during preprocessing and your error most likely comes from a syntax error you have made before some include of that particular generated header.

1 Like

I just deleted my classes then it was resolved.

1 Like