on the simplest, he caught errors, when declaring std :: optional, it swears at the absence of an optional member in the namespace. What could be the problem
#include <optional> int main() { std::optional<char> a; return 0; } on the simplest, he caught errors, when declaring std :: optional, it swears at the absence of an optional member in the namespace. What could be the problem
#include <optional> int main() { std::optional<char> a; return 0; } A similar error is generated by Visual Studio 2017 if the C ++ 17 mode is not selected in the project settings ( /std:c++17 ). In the Output window, it is accompanied by the message
class template optional is only available with C++17 or later. I suspect that you are looking at compilation errors in this “new” strange GUI-errors window instead of going to the normal human Output window and looking at the full output of the compiler there. For this reason, you did not see the above message.
Errors window can hardly be called new - it definitely is in the studio 2008, and it appeared, if I'm not mistaken, in the 2005 studio. There, by the way, it is really useful, unlike 2017. - freimThe two most common causes of this compiler message may be.
The first reason is that the compiler does not support std::optional .
The second reason is that you did not include the <optional> header.
It may also be that you included this header in Visual Studio before the stdafx.h header.
Source: https://ru.stackoverflow.com/questions/964547/
All Articles