相关疑难解决方法(0)

为什么visual studio代码告诉我cout不是std名称空间的成员?

我正在尝试设置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 …
Run Code Online (Sandbox Code Playgroud)

c++ c++11 visual-studio-code

12
推荐指数
1
解决办法
2万
查看次数

标签 统计

c++ ×1

c++11 ×1

visual-studio-code ×1