Can't compile Shipping game

D:\Program Files\Epic Games\4.9\Engine\Intermediate\Build\Win64\UE4\Shipping\LookAbout\PCH.LookAbout.h.cpp(1): error C2850: ‘PCH header file’ : only allowed at file scope; may not be in a nested construct

According to most of the internet, this error means I’ve forgotten a } or a ;. But since I compile Development, this obviously isn’t the case. So next, you think, I must have a #if UE_BUILD_SHIPPING somewhere that has removed a ; or }. I don’t have any #if UE_BUILD_SHIPPING macros though. The only code I have that gets removed by shipping would be UE_LOG. And I looked over all of my UE_LOGs and found nothing like one of them somehow wrapping up a semicolon or curly brace.

Full log:

1>------ Skipped Build: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
1>Project not selected to build for this solution configuration 
2>------ Build started: Project: LookAbout, Configuration: Shipping_Game x64 ------
2>  Performing full C++ include scan (building a new target)
2>  Performing 16 actions (4 in parallel)
2>  PCH.LookAbout.h.cpp
2>D:\Program Files\Epic Games\4.9\Engine\Intermediate\Build\Win64\UE4\Shipping\LookAbout\PCH.LookAbout.h.cpp(1): error C2850: 'PCH header file' : only allowed at file scope; may not be in a nested construct
2>  -------- End Detailed Actions Stats -----------------------------------------------------------
2>ERROR : UBT error : Failed to produce item: D:\Workspaces\Unreal\LookAbout\Binaries\Win64\LookAboutGame-Win64-Shipping.exe
2>  Total build time: 31.12 seconds
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""D:\Program Files\Epic Games\4.9\Engine\Build\BatchFiles\Build.bat" LookAboutGame Win64 Shipping "D:\Workspaces\Unreal\LookAbout\LookAbout.uproject" -rocket -waitmutex" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========

Hey ,

Could you please provide me with the full error output logs to review? Upload them to your next reply. Please also check and see whether or not you receive this same error in 4.10 and our 4.11 preview.

Thank you!

Hey ,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you!

I can’t really just casually upgrade to 4.10. I added the full build log. This doesn’t happen in my other projects. And no one else has reported this problem in relation to UnrealEngine as far as I can tell. Really just need some Epic programmer insight as to what might be happening here.

If you copy your project instead of converting it to a new version of the engine, you’ll have a project for 4.9, 4.10 and 4.11 if you choose. That can help see if your issue is engine related or something you’ve actually made a mistake on.

Error C2850: is normally an error related to an error or typo within your code. Please review your file and make sure there aren’t any special characters, or even parts of code left out.4

According to the error message, you should look in this file: PCH.LookAbout.h.cpp(1)

Upgrading isn’t that simple. My project is a code project and has API dependencies that could have changed in 4.10 or 4.11.

Also, you really don’t understand this issue. Can you please not accept your answer? Look in PCH.LookAbout.h.cpp??? That’s a precompiled header, an auto generated file, generated by UE4, and it’s perfectly valid because it’s identical to the Development config’s version. I’m not missing a special character. That’s the whole point of this, Development config builds fine. So clearly I’m not missing a special character in the usual sense. I don’t get the impression you’re a programmer. Just please leave this unresolved so that someone who understands the problem can address it.

Hey -

's suggestion of making a copy of the project will still allow you to use your original 4.9 version on the same engine it was created with. The new copy will instead use the 4.10 engine/api changes without affecting your original project at all. This also helps check if the changes made to 4.10 silently fixed the issue for you. If this does not fix the issue for you, can you post the source file for LookAbout.cpp or send a copy of the project so that we can test the problem directly? If you’re able to zip the project and upload to drive or , you can send me a PM on the forum with a download link for privacy rather than posting here publicly.

Cheers

The problem I had with copying the project was fixing any API issues. That wouldn’t be a valid solution for a large project.

I ended up upgrading to 4.12 recently and that did NOT fix the issue. I was able to resolve it though, which I’ll now post.

In my game module header I had declared a log:

DECLARE_LOG_CATEGORY_EXTERN(LALog, Warning, All)

The problem was that it was missing a semicolon. This wasn’t a problem in non-shipping builds because the macro uses a semicolon in those builds.

Really thank you ! I had some cryptic issues too with a file that just contains an enum…
Your answer allowed me to fix the issue.