The following C++ code does not compile with VS2015:
Код: Выделить всё
#include
#include
void main()
{
const time_t t = std::time(nullptr);
std::tm tm = {};
std::localtime_s(&tm, &time);
}
Код: Выделить всё
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
t.cpp
t.cpp(10): error C2039: 'localtime_s': is not a member of 'std'
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\ctime(17):
note: see declaration of 'std'
t.cpp(10): error C2664: 'errno_t localtime_s(tm *const ,const time_t *const )':
cannot convert argument 2 from 'time_t (__cdecl *)(time_t *const )' to 'const time_t *const '
t.cpp(10): note: There is no context in which this conversion is possible
Note: using
Код: Выделить всё
std::localtime()Источник: https://stackoverflow.com/questions/509 ... -in-vs2015