x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

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.

Product Version: UE 4.17
Tags:
more ▼

asked Aug 10 '17 at 08:19 AM in Bug Reports

avatar image

SlimeQ
327 10 21 37

avatar image Doug E ♦♦ STAFF Aug 11 '17 at 03:58 PM

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?

avatar image SlimeQ Aug 11 '17 at 04:56 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

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.

more ▼

answered Aug 11 '17 at 05:00 PM

avatar image

SlimeQ
327 10 21 37

avatar image tmadec Aug 23 '17 at 01:34 PM

Thank you, finally I can compile my 4.17 project

avatar image Troublesum Oct 16 '17 at 07:22 PM

Same issue, fixed with this.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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"
 
more ▼

answered Dec 20 '17 at 01:19 AM

avatar image

SND R Keene
968 31 120 113

avatar image SlimeQ Jan 04 '18 at 05:46 AM

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

avatar image Motanum Oct 30 '18 at 10:17 PM

Your solution fixed it for me! I couldnt compile when I was include Steam_Api.h

Thanks so much!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Jan 05 '18 at 08:05 AM

avatar image

SlimeQ
327 10 21 37

avatar image ItBurn Mar 24 '19 at 03:05 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question