tomlooman / EpicSurvivalGame

Third-person Survival Game for Unreal Engine (Sample Project)
https://www.tomlooman.com/unreal-engine-cpp-survival-sample-game/
MIT License
3.24k stars 1.18k forks source link

Compilation error on 4.20 after last commit #52

Open dc740 opened 6 years ago

dc740 commented 6 years ago

I tried to compile this for the first time, and the code from this commit gave me some trouble: https://github.com/tomlooman/EpicSurvivalGameSeries/commit/e8193337becc15bdba6213ac959b5b4e47b2fda8

ProcessResult.StdOut: Performing 2 actions (16 in parallel) ProcessResult.StdOut: [1/2] Compile Module.SurvivalGame.cpp ProcessResult.StdErr: In file included from /media/dc740/a2be0123-5f46-4405-89f3-475303f5b9b7/Proyectos/UnrealSurvivalGameSeries/SurvivalGame/Intermediate/Build/Linux/B4D820EA/UE4Editor/Development/SurvivalGame/Module.SurvivalGame.cpp:31: ProcessResult.StdErr: /media/dc740/a2be0123-5f46-4405-89f3-475303f5b9b7/Proyectos/UnrealSurvivalGameSeries/SurvivalGame/Source/SurvivalGame/Private/World/SGameMode.cpp:422:135: error: '&&' within '||' [-Werror,-Wlogical-op-parentheses] ProcessResult.StdErr: if (!Actor->IsA(ALevelScriptActor::StaticClass()) && !Actor->IsA(ASMutator::StaticClass()) && Actor->GetRootComponent() != nullptr && Actor->GetRootComponent()->Mobility != EComponentMobility::Static || (!Actor->IsA(AStaticMeshActor::StaticClass()) && !Actor->IsA(ALight::StaticClass()))) ProcessResult.StdErr:  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ ~~ ProcessResult.StdErr: /media/dc740/a2be0123-5f46-4405-89f3-475303f5b9b7/Proyectos/UnrealSurvivalGameSeries/SurvivalGame/Source/SurvivalGame/Private/World/SGameMode.cpp:422:135: note: place parentheses around the '&&' expression to silence this warning ProcessResult.StdErr: if (!Actor->IsA(ALevelScriptActor::StaticClass()) && !Actor->IsA(ASMutator::StaticClass()) && Actor->GetRootComponent() != nullptr && Actor->GetRootComponent()->Mobility != EComponentMobility::Static || (!Actor->IsA(AStaticMeshActor::StaticClass()) && !Actor->IsA(ALight::StaticClass()))) ProcessResult.StdErr:  ^ ProcessResult.StdErr:  ( ) ProcessResult.StdErr: 1 error generated. ProcessResult.StdOut: ERROR: UBT ERROR: Failed to produce item: /media/dc740/a2be0123-5f46-4405-89f3-475303f5b9b7/Proyectos/UnrealSurvivalGameSeries/SurvivalGame/Binaries/Linux/libUE4Editor-SurvivalGame.so ProcessResult.StdOut: (see /home/dc740/Library/Logs/Unreal Engine/LocalBuildLogs/UBT-SurvivalGameEditor-Linux-Development_2.txt for full exception trace) ProcessResult.StdOut: Total build time: 23.13 seconds (Local executor: 0.00 seconds) CommandUtils.Run: Took 23.969898s to run mono, ExitCode=5

I "fixed" it by adding extra parenthesis on the first set of AND conditions, like this

if ((!Actor->IsA(ALevelScriptActor::StaticClass()) && !Actor->IsA(ASMutator::StaticClass()) && Actor->GetRootComponent() != nullptr &&
                Actor->GetRootComponent()->Mobility != EComponentMobility::Static) || (!Actor->IsA(AStaticMeshActor::StaticClass()) && !Actor->IsA(ALight::StaticClass())))

Now it compiles just fine.

Thank you

virtualme1 commented 6 years ago

Thanks works on Ubuntu 18.04.1 now with ue4.20.1

chris3199 commented 6 years ago

Still having the same trouble but now on windows with ue 4.20.2

Masakralny commented 6 years ago

I tried to generate project files ,because of compilation problems. What should I do with this error? ERROR: UnrealBuildTool Exception: Visual Studio 2017 requires the Universal CRT to be installed. I have Win 8.1 64bit.... Universal CRT is installed and Win 8.1 SDK is installed ,too...