# Can't compile after upgrading to 4.17, syntax error in gen.cpp

**URL:** <https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788>\
**Category:** Platform & Builds\
**Tags:** steamworks, error-compile, UE4-17, unreal-engine, compile, generated, question\
**Created:** [August 10, 2017, 8:19am UTC](https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788 "2017-08-10T08:19:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![SlimeQ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SlimeQ](https://forums.unrealengine.com/u/SlimeQ)\
**Post date:** [August 10, 2017, 8:19am UTC](https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788/1 "2017-08-10T08:19:23Z")

</div>

I’m attempting to upgrade my project from a custom 4.16.3 build to 4.17. I’ve managed to jump through the most obvious hoops but I’m now getting errors inside the gen.cpp files for every class that contains an AddDynamic binding.

```
C:\Users\quinc\Documents\Unreal Projects\ProxyWarVR 4.15\Intermediate\Build\Win64\UE4Editor\Inc\ProxyWarVR\FlyDudesBotSpawnTriggerBox.gen.cpp(33): error C2059: syntax error: ')'
C:\Users\quinc\Documents\Unreal Projects\ProxyWarVR 4.15\Intermediate\Build\Win64\UE4Editor

```

Looking at the code, this appears to always happen in the same place:

```
	void AProxyWarVRPluginCharacter::StaticRegisterNativesAProxyWarVRPluginCharacter()
	{
		UClass* Class = AProxyWarVRPluginCharacter::StaticClass();
		static const TNameNativePtrPair<ANSICHAR> AnsiFuncs[] = {
			{ "ExtendedSimpleMoveToLocation", (Native)&AProxyWarVRPluginCharacter::execExtendedSimpleMoveToLocation },
			{ "GetTeleportLocation", (Native)&AProxyWarVRPluginCharacter::execGetTeleportLocation },
			{ "NotifyOfTeleport", (Native)&AProxyWarVRPluginCharacter::execNotifyOfTeleport },
		};
		FNativeFunctionRegistrar::RegisterFunctions(Class, AnsiFuncs, ARRAY_COUNT(AnsiFuncs));
	}

```

On the RegisterFunctions call. I’m getting a few suspicious warnings from the steamworks api as well:

```
c:\program files\epic games\ue_4.17\engine\source\thirdparty\steamworks\steamv139\sdk\public\steam\steamtypes.h(99): warning C4005: 'ARRAY_COUNT': macro redefinition
c:\program files\epic games\ue_4.17\engine\source\runtime\core\public\Templates/UnrealTemplate.h(135): note: see previous definition of 'ARRAY_COUNT'
c:\program files\epic games\ue_4.17\engine\source\thirdparty\steamworks\steamv139\sdk\public\steam\matchmakingtypes.h(45): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\string.h(346): note: see declaration of 'strncpy'
c:\program files\epic games\ue_4.17\engine\source\thirdparty\steamworks\steamv139\sdk\public\steam\matchmakingtypes.h(47): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\string.h(346): note: see declaration of 'strncpy'
c:\program files\epic games\ue_4.17\engine\source\thirdparty\steamworks\steamv139\sdk\public\steam\matchmakingtypes.h(161): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\stdio.h(1952): note: see declaration of '_snprintf'
c:\program files\epic games\ue_4.17\engine\source\thirdparty\steamworks\steamv139\sdk\public\steam\matchmakingtypes.h(246): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\string.h(346): note: see declaration of 'strncpy'
C:\Program Files\Epic Games\UE_4.17\Engine\Source\ThirdParty\Steamworks\Steamv139\sdk\public\steam/steam_api.h(273): warning C4265: 'CCallbackImpl<24>': class has virtual functions, but destructor is not virtual
         instances of this class may not be destructed correctly

```

I suspect the ARRAY\_COUNT macro redefinition is the culprit here, somehow. That warning was popping up in 4.16 too, as well as the strncpy warning, but something has clearly changed because the CCallbackImpl warning is new.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [August 11, 2017, 3:58pm UTC](https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788/2 "2017-08-11T15:58:34Z")

</div>

Hey SlimeQ-

When you say “from a custom 4.16.3 build to 4.17” is the 4.17 engine custom from source as well? I tried adding a component and creating an `OnComponentBeginOverlap.AddDynamic();` call in the constructor but was still able to compile without issue. Do you get the same error in a new project if you add the AddDynamic call?

---

<div class="post-metadata">

**Author:** ![SlimeQ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SlimeQ](https://forums.unrealengine.com/u/SlimeQ)\
**Post date:** [August 11, 2017, 4:56pm UTC](https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788/3 "2017-08-11T16:56:03Z")

</div>

4.17 is a binary build. I was able to fix this, it definitely has to do with the ARRAY\_COUNT macro redefinition in the steamworks api

---

<div class="post-metadata">

**Author:** ![SlimeQ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SlimeQ](https://forums.unrealengine.com/u/SlimeQ)\
**Post date:** [August 11, 2017, 5:00pm UTC](https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788/4 "2017-08-11T17:00:46Z")

</div>

I was able to fix this by going into the steamworks api (C:\Program Files\Epic Games\UE\_4.17\Engine\Source\ThirdParty\Steamworks\Steamv139\sdk\public\steam) and replacing all instances of ARRAY\_COUNT to STEAM\_ARRAY\_COUNT. I was getting a macro redefinition warning in 4.16 also but apparently something about the way 4.17 generates code made this cause a syntax error on AddDynamic.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_65927d77](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_65927d77](https://forums.unrealengine.com/u/anonymous_user_65927d77)\
**Post date:** [August 23, 2017, 1:34pm UTC](https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788/5 "2017-08-23T13:34:36Z")

</div>

Thank you, finally I can compile my 4.17 project

---

<div class="post-metadata">

**Author:** ![Troublesum](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Troublesum](https://forums.unrealengine.com/u/Troublesum)\
**Post date:** [October 16, 2017, 7:22pm UTC](https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788/6 "2017-10-16T19:22:42Z")

</div>

Same issue, fixed with this.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_01dd28a6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_01dd28a6](https://forums.unrealengine.com/u/anonymous_user_01dd28a6)\
**Post date:** [December 20, 2017, 1:19am UTC](https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788/7 "2017-12-20T01:19:34Z")

</div>

Had a similar problem. Fixed it by defining the ARRAY\_COUNT back to what it was after the steam api include. Like this in my header file…

```
#pragma once

#include "Engine/GameInstance.h"
#include "OnlineSessionInterface.h"

#include "steam/steam_api.h"
#define ARRAY_COUNT( array ) (sizeof(ArrayCountHelper(array)) - 1)

#include "DSSGameInstanceBase.generated.h"

```

---

<div class="post-metadata">

**Author:** ![SlimeQ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SlimeQ](https://forums.unrealengine.com/u/SlimeQ)\
**Post date:** [January 4, 2018, 5:46am UTC](https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788/8 "2018-01-04T05:46:45Z")

</div>

This seems like a much less obnoxious solution than mine, thanks for the tip

---

<div class="post-metadata">

**Author:** ![SlimeQ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SlimeQ](https://forums.unrealengine.com/u/SlimeQ)\
**Post date:** [January 5, 2018, 8:05am UTC](https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788/9 "2018-01-05T08:05:17Z")

</div>

Just found this little bit in the AdvancedSteamSessions plugin:

```
#pragma push_macro("ARRAY_COUNT")
#undef ARRAY_COUNT

#if USING_CODE_ANALYSIS
MSVC_PRAGMA(warning(push))
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
#endif	// USING_CODE_ANALYSIS

#include <steam/steam_api.h>

#if USING_CODE_ANALYSIS
MSVC_PRAGMA(warning(pop))
#endif	// USING_CODE_ANALYSIS

#pragma pop_macro("ARRAY_COUNT")

```

While a little lengthy, I think this is probably technically better than SND R Keene’s answer since it won’t be affected if ARRAY\_COUNT ever changes for some reason.

---

<div class="post-metadata">

**Author:** ![Motanum](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Motanum](https://forums.unrealengine.com/u/Motanum)\
**Post date:** [October 30, 2018, 10:17pm UTC](https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788/10 "2018-10-30T22:17:52Z")

</div>

Your solution fixed it for me! I couldnt compile when I was include Steam\_Api.h

Thanks so much!

---

<div class="post-metadata">

**Author:** ![ItBurn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ItBurn](https://forums.unrealengine.com/u/ItBurn)\
**Post date:** [March 24, 2019, 3:05am UTC](https://forums.unrealengine.com/t/cant-compile-after-upgrading-to-4-17-syntax-error-in-gen-cpp/401788/11 "2019-03-24T03:05:03Z")

</div>

Thanks for this! It’s unfortunate that we have to deal with this.
