VSCode“变体不是模板",如何让vscode检测到它? [英] VSCode "variant is not a template", how to make vscode detect it?

查看:41
本文介绍了VSCode“变体不是模板",如何让vscode检测到它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个在 c++ 中使用 vscode 的简单结构

I am writing a simple structure in using vscode in c++

#include <variant>
using namespace std;
struct Entry {
  string name;
  variant<double,int> v;
};

我使用的是 微软的 C/C++ 扩展.

尽管它编译得很好,但不知何故,扩展无法检测到 variant 类.

Despite the fact that it's compiling just fine, somehow the extension is unable to detect the variant class.

如何使用 VScode 解决此问题?

How do I fix this issue with VScode?

推荐答案

找到了!

  • 转到扩展 >C/C++ >齿轮图标 >扩展设置
  • 在上方的搜索栏中添加标准"
  • 寻找C_Cpp"默认值:Cpp 标准"进入.
  • 单击下拉列表并选择您需要的最高 C++ 标准.
  • 重新加载,错误就会消失.

C 中的这类问题也是如此.
这个扩展的默认 c++ 标准似乎有时不够用.

The Same goes for this kind of problems in C.
It seems like the default c++ standard of this extension can sometimes be insufficient.

这篇关于VSCode“变体不是模板",如何让vscode检测到它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆