Skip to content

My vscode cannot recognize "cout" "endl" etc... (MinGW) #757

@roblourens

Description

@roblourens

From @LiuZHolmes on May 23, 2017 3:11

  • VSCode Version: Code 1.12.2 (19222cdc84ce72202478ba1cec5cb557b71163de, 2017-05-10T13:20:36.315Z)
  • OS Version: Windows_NT ia32 10.0.14393
  • Extensions:
Extension Author Version
code-gnu-global austin 0.2.2
code-runner formulahendry 0.6.17
vscode-clang mitaki28 0.2.2
cpptools ms-vscode 0.11.1
debug webfreak 0.19.0
c-cpp-snippets wlhe 0.1.0

I already set my cpp_properties correctly(I think),like:

        {
            "name": "Win32",
            "includePath": [ "C:/MinGW/include/*", 
            "C:/MinGW/lib/gcc/mingw32/5.3.0/include/*" ,
            "C:/MinGW/lib/gcc/mingw32/5.3.0/include/c++/*", 
            "C:/MinGW/lib/gcc/mingw32/5.3.0/include/c++/mingw32", 
            "C:/MinGW/lib/gcc/mingw32/5.3.0/include/c++/backward" ],
            "defines": [
                "_DEBUG",
                "UNICODE"
            ],
            "browse": {
                "path": [],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }

And with the simple code:

#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
	cout << "Hello world!" << endl;
	int a;
	cin >> a;
	return 0;
}

there are errors like:

'identifier "cout" is undefined'
'argument list for variable template "endl" is missing'
'identifier "cin" is undefined'


Steps to Reproduce:

1.Install vscode and cpp extensions

2.Set your cpp_properties like me(you may need to change the directory of mingw)

Copied from original issue: microsoft/vscode#27110

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServicefixedCheck the Milestone for the release in which the fix is or will be available.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions