Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

namespace "std" has no member "cout" #895

Closed
lh123 opened this issue Jul 19, 2017 · 15 comments
Closed

namespace "std" has no member "cout" #895

lh123 opened this issue Jul 19, 2017 · 15 comments

Comments

@lh123
Copy link
Contributor

lh123 commented Jul 19, 2017

  • VsCode Version : 1.14.1
  • Extension Version:0.12.1
  • Os : Win10 64Bit
  • gcc : Mingw64(5.3.0)
  1. c_cpp_properties.json
    2

  2. my code
    1

  3. error tip
    image

@bobbrow
Copy link
Member

bobbrow commented Jul 19, 2017

I just tried out mingw-w64 and was able to get std types to resolve by adding "__cdecl=" to the "defines" array in c_cpp_properties.json. Can you give that a try and let me know if that resolves your issue?

@lh123
Copy link
Contributor Author

lh123 commented Jul 19, 2017

Thank you.
After add __cdecl=__attribute__((__cdecl__)),the problem was solved.

@lh123 lh123 closed this as completed Jul 19, 2017
@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Jul 19, 2017

https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/MinGW.md might help with other MinGW issues too, e.g. according to that __GNUC__=5 should be used with MinGW 5.3.

@bobbrow
Copy link
Member

bobbrow commented Jul 19, 2017

Yeah, I updated that page last night after looking at this issue, but I forgot to post back here.

@EdwinWalela
Copy link

could someone please expound on the solution

@sean-mcmanus
Copy link
Collaborator

@EdwinWalela The symptom has many possible causes. Can you file a new bug with repro details? We need to know what OS and compiler you're using.

@g00ntar
Copy link

g00ntar commented May 7, 2018

  • VsCode Version : 1.23.0
  • Extension Version:0.16.1
  • Os : Win10 64Bit
  • gcc : Mingw64(6.3.0)

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}",
                "C:/MinGW/include/*",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/mingw32"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE",
                "__cdecl=__attribute__((__cdecl__))"
            ],
            "intelliSenseMode": "msvc-x64",
            "browse": {
                "path": [
                    "${workspaceFolder}",
                    "C:/MinGW/include/*",
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include",
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++",
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/mingw32"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 3
}

Same problem: namespace "std" has no member "cout"

@bobbrow
Copy link
Member

bobbrow commented May 7, 2018

@g00ntar, if you have the latest version of the extension installed, you should set the "compilerPath" property and remove the system includes/defines from your includePath and defines. I'm in the process of updating the documentation for today's release which will also allow you to remove the system include paths from browse.path

@sean-mcmanus
Copy link
Collaborator

Also, change intelliSenseMode to "clang-x64".

@Ryuuba
Copy link

Ryuuba commented May 18, 2018

  • VsCode Version: 1.23.1
  • Extension Version: 0.17.1
  • Os: Win10 Pro Education
  • Version: 1803
  • gcc : wsl ubuntu16.04(5.4)

I've followed instruction described in https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/Windows%20Subsystem%20for%20Linux.md, however, the intellisense tool generate: namespace "std" has no member "cout". This issue also is presented with other members in headers I use in my project, e.g., namespace "omnetpp" has no member "simsignal_t"

c_cpp_properties.json

{
    "configurations": [
        {

            "name": "WSL",
            "intelliSenseMode": "clang-x64",
            "compilerPath": "/usr/bin/gcc",
            "includePath": [
                "${workspaceFolder}",
                "/mnt/c/Users/Geo/omnetpp-5.2/include",
                "/mnt/c/Users/Geo/omnetpp-5.2/include/omnetpp",
                "/mnt/c/Users/Geo/omnetpp-5.2/include/omnetpp/platdep",
                "/mnt/c/Users/Geo/omnetpp-5.2/include/platdep",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/cmdenv",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/common",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/envir",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/eventlog",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/layout",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/nedxml",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/qtenv",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/qtenv/osg",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/scave",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/sim",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/sim/netbuilder",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/sim/parsim",
                "/mnt/c/Users/Geo/omnetpp-5.2/src/tkenv",
                "/mnt/c/Users/Geo/inet/src",
                "/mnt/c/Users/Geo/inet/src/inet",
                "/mnt/c/Users/Geo/inet/src/inet/common",
                "/mnt/c/Users/Geo/inet/src/inet/common/geometry/common",
                "/mnt/c/Users/Geo/inet/src/inet/mobility/base",
                "/mnt/c/Users/Geo/inet/src/inet/mobility/contract",
                "/mnt/c/Users/Geo/inet/src/inet/mobility/single",
                "${workspaceRoot}/src",
                "${workspaceRoot}/src/base",
                "${workspaceRoot}/src/engine",
                "${workspaceRoot}/src/simple"
            ],
            "defines": [
            ],
            "browse": {
                "path": [
                    "${workspaceFolder}",
                    "/mnt/c/Users/Geo/omnetpp-5.2/include",
                    "/mnt/c/Users/Geo/omnetpp-5.2/src",
                    "/mnt/c/Users/Geo/inet/src",
                    "/mnt/c/Users/Geo/gsim/slaw/src"
        
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

@bobbrow
Copy link
Member

bobbrow commented May 18, 2018

@Ryuuba, can you set "C_Cpp.loggingLevel": "Debug", then open a .cpp file? The extension will log the include path that it ended up using in the Output window (select the C/C++ filter to see logging from our extension). Can you check and see what is printed there?

@Ryuuba
Copy link

Ryuuba commented May 18, 2018

@bobbrow, In the log file, I actually see all paths I use in my project as well as includes/defines related to gcc. I attach the result in the following file:
log.txt

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented May 18, 2018

@Ryuuba Yeah, those logs look normal. This sounds like a new issue we haven't seen reported before. I'm not able to repro it so far. Does Go to Definition on #include <iostream> go to the file at "...\usr\include\c++\5"?

@Ryuuba
Copy link

Ryuuba commented May 18, 2018

@sean-mcmanus yes, it does, but it does not if I use that option on an include statement to go a file that is out of ${workspaceFolder} despite the path of such file is "includePath"

@bobbrow
Copy link
Member

bobbrow commented May 18, 2018

We should move this to a new issue so that we don't lose it. This issue is closed.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants