vscode c++ 报identifier “string” is undefined

问题

  1. 新装了电脑, 装好vsc和g++等, 发现报错
    在这里插入图片描述
  2. 但开头并没问题
    在这里插入图片描述

解决

  1. shift+ctrl+p
  2. 选择 C/C++ Edit:COnfigurations (JSON)
  3. 自动生成打开 c_cpp_properties.json
  4. 添加g++路径
     "cStandard": "c11",
     "cppStandard": "c++11",
     "compilerPath": "D:\\Code\\MinGW\\mingw64\\bin\\g++.exe"
    

在这里插入图片描述
5. 报错消失了

一键搞定 VSCode 下的 C/C++基本开发环境配置

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐