This code does not compile with the command g++ -std=c++17 main.cpp
#include <iostream>
#include <experimental/optional>
int main()
{
std::optional<int> x;
std::cout << "Hello World";
return 0;
}
The Errors are the following:
- error: ‘optional’ is not a member of ‘std’
- error: expected primary-expression before ‘int’
Is there a way to get this code to compile?