including "aws/core/auth/AWSCredentialsProvider.h" gives ctime errors in UE4

Trying to include “aws/core/auth/AWSCredentialsProvider.h” but it gives me loads of ctime errors when building my UE4 solution, any ideas what’s wrong?

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(18): error C2039: 'clock_t': is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(18): error C2873: 'clock_t': symbol cannot be used in a using-declaration
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(20): error C2039: 'asctime': is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(20): error C2873: 'asctime': symbol cannot be used in a using-declaration
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(20): error C2039: 'clock': is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(20): error C2873: 'clock': symbol cannot be used in a using-declaration
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(20): error C2039: 'ctime': is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(20): error C2873: 'ctime': symbol cannot be used in a using-declaration
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(21): error C2039: 'difftime': is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(21): error C2873: 'difftime': symbol cannot be used in a using-declaration
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(21): error C2039: 'gmtime': is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(21): error C2873: 'gmtime': symbol cannot be used in a using-declaration
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(21): error C2039: 'localtime': is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(21): error C2873: 'localtime': symbol cannot be used in a using-declaration
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(22): error C2039: 'mktime': is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(22): error C2873: 'mktime': symbol cannot be used in a using-declaration
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(22): error C2039: 'strftime': is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(22): error C2873: 'strftime': symbol cannot be used in a using-declaration
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(22): error C2039: 'time': is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\INCLUDE\ctime(22): error C2873: 'time': symbol cannot be used in a using-declaration

Hi,

Same issue here when I try to add the last gamelift client sdk to my UE4 project.

What can we do ?

Debugging these time header issues on Windows can be a little involved. What appears to be happening is during your build the compiler is pulling in some other time.h files instead of the standard c time.h.

How you may begin to debug this:

  • Try changing include orders in your files

  • Double check your include paths aren’t bringing in something unexpected

  • Get the compiler to generate the pre-processor output and debug when time.h is pulled in (look for when clock_t is first defined and where)

Can you both provide your Gamelift SDK cmake commands (ie VS version, build options)?

Hi,

I recently solved this issue by renaming core/platform/Time.h to core/platform/AWSTime.h