我正在使用VisualStudio2017- 15.9.7进行C++开发,看起来我已经安装了必要的模块。
但是下面的代码给出了错误-“命名空间”std没有成员“variant”。
std::variant在C++17中是受支持的,看起来它是引入中的15.0的。
std::variant
#include <iostream> #include <variant> int main() { std::variant<int, double, std::string> value; }
看起来好像有人问过同样的问题,但问题似乎已经被删除了。
发布于 2019-02-13 11:49:32
您还可以选择Project > Properties > C/C++ > Language
Project
Properties
C/C++
Language
并将C++ Language Standard设置为ISO C++17 Standard (/std:c++17)
C++ Language Standard
ISO C++17 Standard (/std:c++17)
确保在All Configurations和All Platforms上
All Configurations
All Platforms
https://stackoverflow.com/questions/54668866
相似问题