The project could not be compiled (updating to ue4.12)

I have decided to update from 4.8 to 4.12, so I downloaded 4.12 and tried to convert a copy. This gave me an error saying “The project could not be compiled. Would you like to open in visual studio?”
Under this message it game me some information:

Running C:/Program Files (x86)/Epic Games/4.12/Engine/Binaries/DotNET/UnrealBuildTool.exe ShooterGameEditor Development Win64 -project="C:/Users/Preston/Documents/Unreal Projects/Slow_Down 4.12 - 3/Slow_Down.uproject" -editorrecompile -progress -noubtmakefiles -NoHotReloadFromIDE
@progress push 5%
Parsing headers for ShooterGameEditor
  Running UnrealHeaderTool "C:\Users\Preston\Documents\Unreal Projects\Slow_Down 4.12 - 3\Slow_Down.uproject" "C:\Users\Preston\Documents\Unreal Projects\Slow_Down 4.12 - 3\Intermediate\Build\Win64\ShooterGameEditor\Development\ShooterGameEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
Reflection code generated for ShooterGameEditor in 12.569431 seconds
@progress pop
Performing 11 actions (4 in parallel)
[3/11] Resource PCLaunch.rc
[4/11] Resource ModuleVersionResource.rc.inl
PCH.ShooterGame.h.cpp
PCH.ShooterGameLoadingScreen.h.cpp
[5/11] Resource ModuleVersionResource.rc.inl
[6/11] Resource ShooterGame.rc
ShooterGameLoadingScreen.cpp
C:\Users\Preston\Documents\Unreal Projects\Slow_Down 4.12 - 3\Source\ShooterGame\Public\Online\ShooterGameMode.h(30): error C3668: 'AShooterGameMode::PreLogin': method with override specifier 'override' did not override any base class methods
C:\Users\Preston\Documents\Unreal Projects\Slow_Down 4.12 - 3\Source\ShooterGame\Public\Online\ShooterGameMode.h(30): warning C4263: 'void AShooterGameMode::PreLogin(const FString &,const FString &,const TSharedPtr<ObjectType,0> &,FString &)': member function does not override any base class virtual member function
        with
        [
            ObjectType=FUniqueNetId
        ]
C:\Users\Preston\Documents\Unreal Projects\Slow_Down 4.12 - 3\Source\ShooterGame\Public\Online\ShooterGameMode.h(149): warning C4264: 'void AGameMode::PreLogin(const FString &,const FString &,const TSharedPtr<const FUniqueNetId,0> &,FString &)': no override available for virtual member function from base 'AGameMode'; function is hidden
C:\Program Files (x86)\Epic Games\4.12\Engine\Source\Runtime\Engine\Classes\GameFramework/GameMode.h(447): note: see declaration of 'AGameMode::PreLogin'
C:\Program Files (x86)\Epic Games\4.12\Engine\Intermediate\Build\Win64\UE4Editor\Inc\Engine\GameplayStatics.generated.h(42): note: see declaration of 'AGameMode'
[8/11] Link UE4Editor-ShooterGameLoadingScreen.dll
   Creating library C:\Users\Preston\Documents\Unreal Projects\Slow_Down 4.12 - 3\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ShooterGameLoadingScreen.lib and object C:\Users\Preston\Documents\Unreal Projects\Slow_Down 4.12 - 3\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-ShooterGameLoadingScreen.exp
ERROR: UBT ERROR: Failed to produce item: C:\Users\Preston\Documents\Unreal Projects\Slow_Down 4.12 - 3\Binaries\Win64\UE4Editor-ShooterGame.dll
Total build time: 101.68 seconds

Thanks,
Preston.

Did you just copy-paste the code from 4.8? If so it is expected this will happen. Methods becomes deprecated and you need to update them.

The first thing that stands out is line 21 - function is hidden. This is usually an error with inheritance resolution. Did you remember to call Super::PreLogin()? Is the method signature in AGameMode::PreLogin still “const FString&, const FString&, const TSharedPtr&, FString&”? If the project was trying to automatically convert your project I can imagine a lot of errors will occur.

I copy-pasted the code from the error when I was updating my project using the unreal engine 4.12 project browser.
Now, I should mention that I am in no way a programmer outside of blueprints (I’m sorry), so i’m going to try my best to follow what you’re suggesting, all I ask is that you understand i’m really bad at this! :slight_smile:

Anyways, where would I need to call Super::PreLogin()? I never did such a thing in c++, and I never messed with the project solution as a whole. And secondly, how would I go about manually converting the project, what process would I follow? (Be it using another, better update method, Or going through and changing settings, text files, or changing lines of code in the project solution)

Thank you for your patience!

If anything I should be apologizing to you. I answered on my phone, so I didn’t have the ease of adding references and looking at the source code.

First, AGameMode can be found in ENGINE_INSTALL\Source\Runtime\Engine\Classes\GameFramework\GameMode.h. In 4.12.5, PreLogin can be found on line 447:

virtual void PreLogin(const FString& Options, const FString& Address, const TSharedPtr<const FUniqueNetId>& UniqueId, FString& ErrorMessage);

From the looks of it you are using the ShooterGame sample project. In that project, PreLogin can be found at SHOOTER_GAME\Source\ShooterGame\Public\Online\ShooterGameMode.h:31.

virtual void PreLogin(const FString& Options, const FString& Address, const TSharedPtr<const FUniqueNetId>& UniqueId, FString& ErrorMessage) override;

The .cpp file (the implementation) can be found in the same location, but in the private directory instead of the public directory - SHOOTER_GAME\Source\ShooterGame\Private\Online\ShooterGameMode.cpp:251.

void AShooterGameMode::PreLogin(const FString& Options, const FString& Address, const TSharedPtr<const FUniqueNetId>& UniqueId, FString& ErrorMessage)
{
	AShooterGameState* const MyGameState = Cast<AShooterGameState>(GameState);
	const bool bMatchIsOver = MyGameState && MyGameState->HasMatchEnded();
	if( bMatchIsOver )
	{
		ErrorMessage = TEXT("Match is over!");
	}
	else
	{
		// GameSession can be NULL if the match is over
		Super::PreLogin(Options, Address, UniqueId, ErrorMessage);
	}
}

You’ll notice the Super::PreLogin call at the end there. This simply means "Call the parent class’s implementation of this method.

Now, you should go and make sure that your GameMode::PreLogin methods have the same signatures that I noted above.

Sorry about the late reply! Super busy morning! I just checked it and did a CTRL+F for the thing that says “// gamesession can be NULL ect…” message, and this is what I had:

void AShooterGameMode::PreLogin(const FString& Options, const FString& Address, const TSharedPtr<FUniqueNetId>& UniqueId, FString& ErrorMessage)
{
	AShooterGameState* const MyGameState = Cast<AShooterGameState>(GameState);
	const bool bMatchIsOver = MyGameState && MyGameState->HasMatchEnded();
	if( bMatchIsOver )
	{
		ErrorMessage = TEXT("Match is over!");
	}
	else
	{
		// GameSession can be NULL if the match is over
		Super::PreLogin(Options, Address, UniqueId, ErrorMessage);
	}
}

From what I can tell it’s identical, that was the right thing to look for right? or did I look in the wrong place for the wrong thing?

Aha, there’s your problem. See the “const TSharedPtr”. It should be “const TSharedPtr&”.

Edit: Curse html parsing.

const TSharedPtr<FUniqueNetId>&

should be

const TSharedPtr<const FUniqueNetId>&

Just did that on both the cpp and the Header. I got a ton of errors, but they all look about the same (There are two types, and a class name/function name or whatever will change, but the overall error for all of them is the same), here are the two different kinds I get

102967-thisiszombocom.png

Severity	Code	Description	Project	File	Line	Suppression State
Warning	C4996	'AGameMode::GetIntOption': Use UGameplayStatics::GetIntOption instead Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.	Slow_Down	C:\Users\Preston\Documents\Unreal Projects\Slow_Down 4.11\Source\ShooterGame\Private\Online\ShooterGameMode.cpp	43	

It says to update my API? Is that what I should do? If so, how does one go about that without destroying his/her project?

This just seems like a general project migration failure. Migration does not update the old code to new code - it simply sets the project version and updates which engine version to compile the project with.

At this point there could be countless errors as you have found out. My solution for you is to redownload the ShooterGame project and manually transfer your old work over one step at a time. Upgrading 4 engine versions is a huge leap in terms of compatibility, so it will require a bit of work on your part.

You have just discovered why game companies stick with a single engine version instead of upgrading the moment a new engine release comes out.

Gotcha, I will just do that then, or maybe I won’t even worry about it, what sickens me is that they push it so hard. And it makes you feel like it would be wise to update. Oh well, I guess I will figure it out! Thanks for your help!

To be fair 4.12 is significantly better than 4.8 in a lot of ways. There are a lot of quality of life fixes and additions.

If you run into any issues should you decide to manually transfer over feel free to let me know.

Will do, thank you for you help and patience. Super kind of you and super considerate of you. You really helped me out!

Hello,

While converting to a new version of the engine can definitely cause some conversation related issues, I imagine a lot of this is due to trying to jump 4 versions at once. If you do plan to do this again in the future, I would suggest doing the conversions one at a time. Part of this is that, when things are planned to be deprecated or changed, a message will usually be given at compile time to let you know of the upcoming change instead of outright failing.