vscode c++ 报错identifier “string“ is undefined

vscode c++ 报identifier “string” is undefined

问题

  1. 新装了电脑, 装好vsc和g++等, 发现报错
    vscode c++ 报错identifier “string“ is undefined_第1张图片
  2. 但开头并没问题
    vscode c++ 报错identifier “string“ is undefined_第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"
    

vscode c++ 报错identifier “string“ is undefined_第3张图片
5. 报错消失了

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

你可能感兴趣的:(vscode,c++)