Atomic.h Error in all new Projects

In all my projects (New and Old) I have an error that appears before any code is added or changed

E0018	expected a ')'	UE4	C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Core\Public\Templates\Atomic.h	188	

When I add an actor or begin to edit code a number of cannot open source file error also appear

Error (active) E1696 cannot open source file “ActorComponent.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\Components\ActorComponent.h 17
Error (active) E1696 cannot open source file “ChildActorComponent.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\Components\ChildActorComponent.h 11
Error (active) E1696 cannot open source file “SceneComponent.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\Components\SceneComponent.h 13
Error (active) E1696 cannot open source file “EdGraphNode.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\EdGraph\EdGraphNode.h 10
Error (active) E1696 cannot open source file “EdGraphPin.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\EdGraph\EdGraphPin.h 13
Error (active) E1696 cannot open source file “EngineBaseTypes.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\Engine\EngineBaseTypes.h 17
Error (active) E1696 cannot open source file “EngineTypes.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\Engine\EngineTypes.h 16
Error (active) E1696 cannot open source file “Level.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\Engine\Level.h 17
Error (active) E1696 cannot open source file “MaterialMerging.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\Engine\MaterialMerging.h 8
Error (active) E1696 cannot open source file “NetSerialization.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\Engine\NetSerialization.h 19
Error (active) E1696 cannot open source file “Actor.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h 21
Error (active) E1696 cannot open source file “Interface_AssetUserData.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\Engine\Classes\Interfaces\Interface_AssetUserData.h 10
Error (active) E1696 cannot open source file “InputCoreTypes.generated.h” MyProject C:\Program Files\Epic Games\UE_4.20\Engine\Source\Runtime\InputCore\Classes\InputCoreTypes.h 10

Are these errors that need to be fixed?

i have the same error too, any fixes?

same error.

Had the same error and fixed it. It was a missing module in my Build.cs. I fixed it by adding the “ApplicationCore” module to PublicDependencyModuleNames.

Do you have any ‘unresolved external symbol’ errors?

These are 2 different issues.

The second issue is apparently fixed in 4.20.3. but you can follow the steps in [this forum post][1] if you can’t wait.

The first issue with atomic.h.

I am also experiencing this. I’m guessing it’s a side-effect/bug of VS2017’s recent improvements in Template handling. It’s not really an error but Intellisense is failing to read it properly?

Hi, i’m new in unreal, please can you explain me how to add the ApplicationCore to PublicDepenency. Thank you so much

Yes please… Same here

You may not be missing the same module. In my case it was the ApplicationCore.

To add a module, open the ‘Source’ folder of your game. There should be a build file. Like ‘MyGame.Build.cs’.
There you have to extend the line with the module your game is missing.
For example:

PublicDependencyModuleNames.AddRange(new string[] { "ApplicationCore", and the other game modules for your game});

it didn’t help in my case. my issue is "E0018 expected a ‘)’ ". does your solution address the second issue of the question instead maybe?

I had same error few days ago. I updated VS 2017 (community edition) then error disappeared.

I had same issue too.
Error is fixed by adding () around [UE4Atomic_Private::TIsSupportedSize::Value] , but I don’t know why. And I can’t guarantee it is safe.

template <typename T>
struct alignas((UE4Atomic_Private::TIsSupportedSize<sizeof(T)>::Value) ? alignof(UE4Atomic_Private::TUnderlyingIntegerType_T<T>) : alignof(T)) TAtomicBase_Basic

I just woke up this morning to find that I had the same error. I turned off ransomware protection in Windows Defender and everything compiled beautifully. No idea why it would start doing this now after a few months.

Adding the parenthesis there is fine, this does not change the implemented behavior.

If you are not using C++ i cannot help you, but if you do have access to your code, there’s a file called: [ProjectName].Build.cs, in there you’ll find at line 11 the list of your dependencies, just add ApplicationCore in there

When upgrading to VS 2017, enums are no longer implicitly treated as integers.

You can resolve this issue by casting the Enum to an int in the evaluation.

struct alignas((int) UE4Atomic_Private::TIsSupportedSize::Value ? alignof(UE4Atomic_Private::TUnderlyingIntegerType_T) : alignof(T)) TAtomicBase_Basic

Its a lot of crap just to get a compile time constant that can be passed into a template argument.

This occurs in at least 4.19 and forward when building with VS 2017.

Its not a virus. Its Visual Studio 2017.

After 2 days stuck on this I had tried all of the above, and then figured it might be something to do with the fact that I installed everything I could on D drive to save space on my SSD… I tried uninstalling UE4 and Visual Studio, reinstalled the latest versions (2017 VS and 4.21 UE4) and let it all install into the default places on C drive.

Everything is working fine, at the cost of 1/4 of my C drive. Thought I’d post in case anyone else tries all the troubleshooting tips and can’t fix it. Still using Perforce on my D, no problems so far (only about 6 hours ago so we’ll see).

All have I tried,however it doesn’t work.I add “ApplicationCore”,and I add “()”,and I update visual studio 2017,and I use UE4.20,but I still have these errors.I try to create an empty C++ project and create a new C++ class,then these error come out.Does Anybody know what I shoud do to let these error disappear?I really have no idea.

Had the same issue in 4.21.1, your solution helps, thanks

Guys! It’s helpful for me :

struct alignas((int)UE4Atomic_Private::TIsSupportedSize::Value ? alignof(UE4Atomic_Private::TUnderlyingIntegerType_T) : alignof(T)) TAtomicBase_Basic

it has some different comparison with DanHollingworth but now it works fine for me and Intelligence don’t tell me about this stupid error.

This solved the problem for me, thanks