Keep getting engine errors building game code 4.6

hello
after rebuilding my game code a few times it comes up with engine related errors and refuses to build the game.

Error	2	error C2065: 'EViewModeIndex' : undeclared identifier	c:\unrealengine-4.6\engine\source\runtime\engine\public\ShowFlags.h	376	1	C_Car
Error	3	error C2146: syntax error : missing ')' before identifier 'ViewModeIndex'	c:\unrealengine-4.6\engine\source\runtime\engine\public\ShowFlags.h	376	1	C_Car
Error	4	error C2182: 'ApplyViewMode' : illegal use of type 'void'	c:\unrealengine-4.6\engine\source\runtime\engine\public\ShowFlags.h	376	1	C_Car
Error	5	error C2491: 'ApplyViewMode' : definition of dllimport data not allowed	c:\unrealengine-4.6\engine\source\runtime\engine\public\ShowFlags.h	376	1	C_Car
Error	6	error C2059: syntax error : ')'	c:\unrealengine-4.6\engine\source\runtime\engine\public\ShowFlags.h	376	1	C_Car
Error	7	error C2061: syntax error : identifier 'EViewModeIndex'	c:\unrealengine-4.6\engine\source\runtime\engine\public\ShowFlags.h	379	1	C_Car
Error	8	error C2146: syntax error : missing ';' before identifier 'FindViewMode'	c:\unrealengine-4.6\engine\source\runtime\engine\public\ShowFlags.h	385	1	C_Car
Error	9	error C4430: missing type specifier - int assumed. Note: C++ does not support default-int	c:\unrealengine-4.6\engine\source\runtime\engine\public\ShowFlags.h	385	1	C_Car
Error	10	error C2146: syntax error : missing ')' before identifier 'ViewModeIndex'	c:\unrealengine-4.6\engine\source\runtime\engine\public\ShowFlags.h	388	1	C_Car
Error	11	error C2440: 'initializing' : cannot convert from 'int' to 'const TCHAR *'	c:\unrealengine-4.6\engine\source\runtime\engine\public\ShowFlags.h	388	1	C_Car
Error	12	error C2059: syntax error : ')'	c:\unrealengine-4.6\engine\source\runtime\engine\public\ShowFlags.h	388	1	C_Car
Error	16	error : Failed to produce item: C:\UE4 Projects\C_Car 4.6\Intermediate\Build\Win64\C_CarEditor\Development\UE4Editor-C_Car.exp	C:\UE4 Projects\C_Car 4.6\Intermediate\ProjectFiles\ERROR	C_Car
Error	17	error MSB3073: The command "C:\UnrealEngine-4.6\Engine\Build\BatchFiles\Build.bat C_CarEditor Win64 Development "C:\UE4 Projects\C_Car 4.6\C_Car.uproject"" exited with code -1.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets	38	5	C_Car

also if i run setup.bat again it says certain files have been changed, and i didnt change anything
4.6 preview (promoted tag)

edit:
promoted tag now downloads 4.7, guess this is the reason.
@Epic you really need to sort out the tagging system a bit better, at least say what version it is.

edit2;
this error happens on 4.6 preview, 4.6 and promoted.
what did you do to ShowFlags.h?
now ive converted all to code to 4.6 its not so easy to roll back to 4.5 :frowning:

thanks

so its something in my code and i dont know what. the last things i did before this started happening was changing it to FObjectInitializer and GetMesh() ect as the warnings suggested. now when i compile that project it ‘breaks’ the engine and all other projects suffer the same errors on compile.

Hi ,

I will be taking a closer look at this issue on Friday, but I wanted to get some additional information that should help me reproduce what is going on. I am guessing that you are using one of the vehicle templates, and that you had created a project in a previous version of the Engine, then upgraded it to 4.6. Is that correct? Do you see the same results if you create a new project and upgrade that one as well?

With regards to the GitHub branches, we are working on streamlining those. We will eventually be reducing the number of branches to just three: release, promoted, and master.

  • Release will contain the source code for the currently released Engine version, and will have new code merged into it when a new version is released.
  • Master will remain the same as it is currently, essentially a rolling, live version of the Engine as the developers make changes to it.
  • Promoted is a step up from master, in that it has had some basic testing performed on it and we have determined that all of the basic functionality is there and there were no crashes in the test pass. That does not mean it is release-quality, just that the quick pass we performed didn’t turn up any major problems. It should be a little more stable than the master branch, but we do not recommend using either master or promoted for actual project development. This branch is not updated as frequently as the master branch, but it will see updates quite a bit more frequently than the release branch.

You will still be able to get the source code for any released version of the Engine by looking at the releases page, or with the tag for that specific release version. We apologize if these changes were not communicated clearly. The Twitch stream on the 18th was dedicated to working with GitHub and these changes were briefly mentioned there at around the 15:55 mark.

created a project in a previous version of the Engine, then upgraded it to 4.6. Is that correct?

yes this is correct. unfortunately i dont have enough room to install an older build atm. creating a new project in 4.6 preview seems to already be upgraded. as i look at the 4.6 project code, i see that some of the pointers (that replace TSubobjectPtr) are declared private or use this kind of syntax ‘FORCEINLINE USpringArmComponent* GetSpringArm() const { return SpringArm; }’.

at a guess i would think this might be the cause of the errors, but that is a complete guess.

so its definitely something to do with how things are declared in .h files. is there a guide on how to declare what? it happened again but different errors when i copied the projectile related things from first person c++ to a vehicle based class using the exact same syntax.

I spent some time today trying to reproduce this, and have been unsuccessful so far. I created a couple new projects, one from the Vehicle template and one from the Advanced vehicle template, in 4.5.1 and upgraded them to 4.6. After clearing up the initial errors and warnings, both projects built fine without any errors referencing ShowFlags.h. I am currently upgrading a project from 4.5.1 to the promoted branch from GitHub to see if I can reproduce the errors there.

Are you referencing ShowFlags at all in your project?

You are correct that the pointers replacing the previous TSubobjectPtr components are private, and they have corresponding Get functions to retrieve them from outside the class if necessary. The new macro GENERATED_BODY() leaves the class in the private: access specifier, whereas GENERATED_UCLASS_BODY() would leave the class in the public: access specifier. If you prefer for the components to be public, you can place a public: access specifier immediately before the first component is declared (and then the Get functions become optional).

In practice, your component declaration would change from

TSubobjectPtr<USpringArmComponent> SpringArm;

to

USpringArmComponent* SpringArm;

Then in your code file you would initialize it using ObjectInitializer instead of PCIP.

What parts of the projectile class did you copy into your vehicle class?

hello, thanks for having a look. im unable to make it happen again copying the projectile related things into a vehicle, i dont know what i did wrong before. i do not reference ShowFlags.

here is the class that broke the engine originally, obviously its something i did wrong but i cant see it. .h .cpp.

i dont expect you to debug and fix my code for me but it would be useful to know what broke the engine.

thanks

found the problem!

it wasnt the class i linked before, it was a basically empty AnimInstance class. after removing it from my project it compiles :slight_smile: sorry for the false leads.
.h
#pragma once

#include "Animation/AnimInstance.h"
#include "TegCarAnimInstance.generated.h"

/**
 * 
 */
UCLASS()
class C_CAR_API UTegCarAnimInstance : public UAnimInstance
{
	GENERATED_BODY()


};

.cpp

#include "C_Car.h"
#include "TegCarAnimInstance.h"

Hi ,

Thanks for the additional legwork you did on this issue. I was able to reproduce the same build errors you described in version 4.6, as well as in our latest internal build. It also appears to not be new to 4.6, since I also got the same errors in 4.5.1. I have entered a report about the issue to have it investigated further (UE-6096).

For a workaround, I found that if you add #include "EngineBaseTypes.h" to the ShowFlags.h file, you should be able to build successfully with that code class included in the project.

ok thank you. best of luck with the fix.

Hi ,

I just ran through my test case for this issue with our latest internal build, and the problem is no longer occurring. I was able to build a project fine after adding a code class derived from AnimInstance. You can find the fix here on GitHub. The fix is essentially the same as the workaround I provided. If you get a to merge that in to your Engine source code, please let us know if this corrects the issues you are experiencing, or if you continue to have any additional problems.