«localtime_s»: не является членом «std» в VS2015.C++

Программы на C++. Форум разработчиков
Ответить
Гость
 «localtime_s»: не является членом «std» в VS2015.

Сообщение Гость »


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);
}
The error messages are:

Код: Выделить всё

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
What can be a workaround?
Note: using

Код: Выделить всё

std::localtime()
is not an option.


Источник: https://stackoverflow.com/questions/509 ... -in-vs2015
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»