C++ Climbing tutorial

Found a really great climbing tutorial & was wondering if anyone has tried it out?

i attempted to replicate the code into my project but for some reason none of the declarations or functions are appearing to be registering in the engine. curious…

1 Like

Here’s the error list i get.

Build started…
1>------ Build started: Project: TestProject2, Configuration: Development_Editor x64 ------
1>Invalidating makefile for TestProject2Editor (CustomCharacter.cpp.obj.response modified)
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacter.cpp(1): error : Expected CustomCharacter.h to be first header included.
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(1): error : Expected CustomCharacterMovementComponent.h to be first header included.
1>Building TestProject2Editor…
1>Using Visual Studio 2022 14.37.32824 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822) and Windows 10.0.22621.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>Building 6 actions with 32 processes…
1> [1/6] ECustomMovement.cpp
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\ECustomMovement.cpp(6): error C2653: ‘ECustomMovement’: is not a class or namespace name
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\ECustomMovement.cpp(7): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\ECustomMovement.cpp(8): error C4508: ‘ECustomMovement’: function should return a value; ‘void’ return type assumed
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\ECustomMovement.cpp(10): error C2653: ‘ECustomMovement’: is not a class or namespace name
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\ECustomMovement.cpp(11): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\ECustomMovement.cpp(12): error C4508: ‘{dtor}’: function should return a value; ‘void’ return type assumed
1> [2/6] CustomCharacter.cpp
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacter.cpp(19): error C2199: syntax error: found ‘ACustomCharacter (’ at global scope (was a declaration intended?)
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacter.cpp(19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacter.cpp(19): error C2059: syntax error: ‘const’
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacter.cpp(20): error C2065: ‘ObjectInitializer’: undeclared identifier
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacter.cpp(20): error C2065: ‘UMyCharacterMovementComponent’: undeclared identifier
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacter.cpp(20): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacter.cpp(21): error C2059: syntax error: ‘{’
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacter.cpp(21): error C2143: syntax error: missing ‘;’ before ‘{’
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacter.cpp(21): error C2447: ‘{’: missing function header (old-style formal list?)
1> [3/6] CustomCharacterMovementComponent.cpp
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(8): error C2059: syntax error: ‘const’
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(9): error C2065: ‘ObjectInitializer’: undeclared identifier
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(10): error C2059: syntax error: ‘{’
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(10): error C2143: syntax error: missing ‘;’ before ‘{’
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(10): error C2447: ‘{’: missing function header (old-style formal list?)
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(200): error C2039: ‘IsEmpty’: is not a member of ‘TArray<FHitResult,FDefaultAllocator>’
1> C:\Program Files\Epic Games\UE_4.27\Engine\Source\Runtime\Engine\Classes\Engine/EngineTypes.h(2128): note: see declaration of ‘TArray<FHitResult,FDefaultAllocator>’
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(383): error C2039: ‘Length’: is not a member of ‘FVector’
1> C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Intermediate\Build\Win64\UE4Editor\Inc\TestProject2\CustomCharacterMovementComponent.generated.h(11): note: see declaration of ‘FVector’
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(383): error C2672: ‘FGenericPlatformMath::Max’: no matching overloaded function found
1> C:\Program Files\Epic Games\UE_4.27\Engine\Source\Runtime\Core\Public\GenericPlatform/GenericPlatformMath.h(771): note: could be ‘T FGenericPlatformMath::Max(const TArray<T,FDefaultAllocator> &,int32 *)’
1> C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(383): note: ‘T FGenericPlatformMath::Max(const TArray<T,FDefaultAllocator> &,int32 *)’: could not deduce template argument for ‘const TArray<T,FDefaultAllocator> &’ from ‘int’
1> C:\Program Files\Epic Games\UE_4.27\Engine\Source\Runtime\Core\Public\GenericPlatform/GenericPlatformMath.h(715): note: or ‘T FGenericPlatformMath::Max(const T,const T)’
1> C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(383): note: ‘T FGenericPlatformMath::Max(const T,const T)’: expects 2 arguments - 1 provided
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(383): error C2737: ‘RotationSpeed’: const object must be initialized
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(418): error C2039: ‘Length’: is not a member of ‘FVector’
1> C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Intermediate\Build\Win64\UE4Editor\Inc\TestProject2\CustomCharacterMovementComponent.generated.h(11): note: see declaration of ‘FVector’
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(422): error C2039: ‘Length’: is not a member of ‘FVector’
1> C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Intermediate\Build\Win64\UE4Editor\Inc\TestProject2\CustomCharacterMovementComponent.generated.h(11): note: see declaration of ‘FVector’
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(422): error C2737: ‘SnapSpeed’: const object must be initialized
1>C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Source\TestProject2\CustomCharacterMovementComponent.cpp(450): error C2039: ‘Length’: is not a member of ‘FVector’
1> C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\Intermediate\Build\Win64\UE4Editor\Inc\TestProject2\CustomCharacterMovementComponent.generated.h(11): note: see declaration of ‘FVector’
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ““C:\Program Files\Epic Games\UE_4.27\Engine\Build\BatchFiles\Build.bat” TestProject2Editor Win64 Development -Project=“C:\Users\johnr\OneDrive\Documents\Unreal Projects\TestProject2\TestProject2.uproject” -WaitMutex -FromMsBuild” exited with code 6.
1>Done building project “TestProject2.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped=========

It seems like there are several errors occurring - most of them can be easily solved.
Let’s break down the issues and possible solutions:

  1. Expected Header to be First Included:

    • This is a convention in C++ to include a header file related to you cpp before using any of its contents in another file. CustomCharacter.cpp and CustomCharacterMovementComponent.cpp, the respective header files CustomCharacter.h and CustomCharacterMovementComponent.h should be included as the first header.
  2. Syntax Errors and Undeclared Identifiers:

    • Check these files for typos, missing semicolons, or incorrect variable/function declarations. It’s as simple as that.
  3. Class or Namespace Name Not Found:

    • In ECustomMovement.cpp, the error indicates that ECustomMovement is not recognized as a class or namespace. My guess here is you probably copy pasted the code from Github but named your classes differently, perhaps?
  4. Member Not Found Errors:

    • There are errors indicating that certain members like IsEmpty, Length, and Max are not found. Ensure that you have included the necessary headers where these members are declared. For example, ion the documentation I see that the best way to check for a FVector lenght is by using Size().
  5. Review Dependencies and References:

    • Double-check the dependencies and references in your project. At times, in order to include a plug in, it might be necessary to generate the VS project again.

I was thinking of checking it out this week - did you manage to test it?