Nir*_*bag 12 c++ c++11 visual-studio-code
我正在尝试设置visual studio代码以用c ++编程.我已经安装了扩展C/C++和C/C++ Intellisense
以下是我的代码:
#include<iostream>
using namespace std;
int main()
{
cout<< "hello" ;
}
Run Code Online (Sandbox Code Playgroud)
我得到的错误是identifier cout is undefined当我把它写成std::cout错误时,我得到的是namespace std has no member cout.以下是我的task.json档案:
{
"version": "0.1.0",
"command": "make",
"isShellCommand": true,
"tasks": [
{
"taskName": "Makefile",
// Make this the default build command.
"isBuildCommand": true,
// Show the output window only if unrecognized errors occur.
"showOutput": "always",
// No args
"args": ["all"],
// Use the standard less compilation problem matcher.
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
Aru*_* CM 21
这是一个错误 !!!!
这个错误有一个解决方法,转到VS代码中的文件 - >首选项 - >设置并更改"C_Cpp.intelliSenseEngine": "Default"为"C_Cpp.intelliSenseEngine": "Tag Parser"