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

#include errors detected ... cannot open source file "iostream #1041

Closed
NikoGP opened this issue Sep 18, 2017 · 56 comments
Closed

#include errors detected ... cannot open source file "iostream #1041

NikoGP opened this issue Sep 18, 2017 · 56 comments

Comments

@NikoGP
Copy link

NikoGP commented Sep 18, 2017

Hello, so I am new to coding and wanted to use VS Code to code in C++, so I installed it, installed C/C++ IntelliSense v0.12.4 and followed instructions on the VS Code website to make a c_cpp_properties.json file and copied the code into it like they said. When I open my .cpp project that I had made in notepad++, I get the error:
"#include errors detected. Please update your includePath. IntelliSense features for this translation unit (directory\file.cpp) will be provided by the Tag Parser. (9, 1)
cannot open source file "iostream" (9, 1)"

My .cpp code
`#include

using namespace std;

int main()
{
string firstName, lastName;
double hourRate, numHours;

    cout << "+----------------------------------------+" << endl;
    cout << " Your first name and last name: ";
    cin >> firstName >> lastName;
    cout << " Your hourly rate: ";
    cin >> hourRate;
    cout << " Number of hours worked last week: ";
    cin >> numHours;
    cout << endl;
    
    double regPay, overTPay, gPay, socSec, med, netPay;
    if (numHours <= 40)
    {
        regPay = hourRate * numHours;
        gPay = regPay;
        overTPay = 0;
    }
        else
        {
            double oTHours;
            oTHours = numHours - 40;
            regPay = hourRate * (numHours - (numHours - 40));
            overTPay = (hourRate * 1.5) * oTHours;
            gPay = regPay + overTPay;
        }
    socSec = gPay * 0.062;
    med = gPay * 0.0145;
    netPay = gPay - (socSec + med);
    cout << "+----------------------------------------+" << endl << endl;
    cout << " Pay Stub\n" << " Regular pay  $" << regPay << endl;
    cout << " Overtime pay $" << overTPay << endl;
    cout << " Gross pay    $" << gPay << endl;
    cout << " Social Sec.  $" << socSec << endl;
    cout << " Medicare     $" << med << endl;
    cout << " Net Pay      $" << netPay << endl << endl;
    cout << "+----------------------------------------+" << endl << endl;
    cout << " Pay to: " << firstName << " " << lastName << endl;
    cout << " Total Pay: $" << netPay << endl << "\t\t\t   ";
    cout << "Signed: P inc." << endl;
    cout << "+----------------------------------------+" << endl;
    
    return 0;
}`

My c_cpp_properties.json file

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "/usr/include",
                "/usr/local/include",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/usr/include",
                    "/usr/local/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "macFrameworkPath": [
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ]
        },
        {
            "name": "Linux",
            "includePath": [
                "/usr/include",
                "/usr/local/include",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/usr/include",
                    "/usr/local/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        },
        {
            "name": "Win32",
            "includePath": [
                "${workspaceRoot}"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE"
            ],
            "intelliSenseMode": "msvc-x64",
            "browse": {
                "path": [
                    "${workspaceRoot}",
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++",
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
    ],
    "version": 3
}

Also, when I hover over the "" this shows up:
"#include errors detected. Please update your includePath. IntelliSense features for this translation unit (E:\Stuff\CS11-Things\Homeworks\A3\paycheck.cpp) will be provided by the Tag Parser.
cannot open source file "iostream""

Let me know if you need any more information

@sean-mcmanus
Copy link
Collaborator

Your includePath only has ${workspaceRoot}. You need to add the path to your system directories. If you're using MinGW, see https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/MinGW.md .

@GiBg1aN
Copy link

GiBg1aN commented Sep 19, 2017

If you are using Linux you have to add the path /usr/include/linux

@ZoeVonFeng
Copy link

ZoeVonFeng commented Sep 20, 2017

I had same issue on windows, after I add the "C:\\cygwin64\\lib\\gcc\\x86_64-pc-cygwin\\6.4.0\\include\\c++" at includePath, I got this error: cannot open source file "bits/c++config.h" (dependency of "iostream")

@bobbrow
Copy link
Member

bobbrow commented Sep 20, 2017

What does gcc tell you the include path should be? Run this command and make sure all of the paths printed out are listed in your c_cpp_properties.json: gcc -v -E -x c++ -

@NikoGP
Copy link
Author

NikoGP commented Sep 20, 2017

@sean-mcmanus after adding the code from the link you gave it still complains, I didn't add "C_Cpp.intelliSenseEngine": "Default" to my settings.json file because I have no clue where it is. Anyway, this is the new error I am getting.
"#include errors detected. Please update your includePath. IntelliSense features for this translation unit (E:\\program.cpp) will be provided by the Tag Parser. (9, 1) cannot open source file "iostream" (9, 1)"

@sean-mcmanus
Copy link
Collaborator

@NikoGP Go to File->Preferences->Settings and search for "intelliSenseEngine" to find the setting. You have "Default" set already though. Did you run the gcc command @bobbrow mentioned? Can you provide your updated c_cpp_properties.json? You basically need to find where your iostream header is getting pulled from by your compiler and add the path to the includePath setting (and make sure the defines are correct). Does Go to Definition work on the header file? If so, that means the iostream file was found via a recursive search of your browse.path setting.

@NikoGP
Copy link
Author

NikoGP commented Sep 20, 2017

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "macFrameworkPath": [
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ]
        },
        {
            "name": "Linux",
            "includePath": [
                "/usr/include",
                "/usr/local/include",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/usr/include",
                    "/usr/local/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        },
        {
            "configurations": [
                {
                    "name": "Win32",
                    "intelliSenseMode": "clang-x64",
                    "includePath": [
                        "${workspaceRoot}",
                        "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",
                        "C:/MinGW/lib/gcc/mingw32/5.3.0/include",
                        "C:/MinGW/include",
                        "C:/MinGW/lib/gcc/mingw32/5.3.0/include-fixed"
                    ],
                    "defines": [
                        "_DEBUG",
                        "UNICODE",
                        "__GNUC__=5",
                        "__cdecl=__attribute__((__cdecl__))"
                    ],
                    "browse": {
                        "path": [
                            "C:/MinGW/lib/gcc/mingw32/5.3.0/include",
                            "C:/MinGW/lib/gcc/mingw32/5.3.0/include-fixed",
                            "C:/MinGW/include/*"
                        ],
                        "limitSymbolsToIncludedHeaders": true,
                        "databaseFilename": ""
                    }
                }
            ],
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 3
}

Here is my current c_cpp_properties.json file, when I hover over the "{" before configurations Win32 it says "missing property "name""
Also, I installed cygwin before installing MingW, I'm not sure if that messes anything up or not

@bobbrow
Copy link
Member

bobbrow commented Sep 20, 2017

I reformatted your comment. There is a "configurations" element inside your "configurations" which is invalid syntax for the c_cpp_properties.json file. Fix it like below:

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "macFrameworkPath": [
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ]
        },
        {
            "name": "Linux",
            "includePath": [
                "/usr/include",
                "/usr/local/include",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/usr/include",
                    "/usr/local/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        },
        {
                    "name": "Win32",
                    "intelliSenseMode": "clang-x64",
                    "includePath": [
                        "${workspaceRoot}",
                        "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",
                        "C:/MinGW/lib/gcc/mingw32/5.3.0/include",
                        "C:/MinGW/include",
                        "C:/MinGW/lib/gcc/mingw32/5.3.0/include-fixed"
                    ],
                    "defines": [
                        "_DEBUG",
                        "UNICODE",
                        "__GNUC__=5",
                        "__cdecl=__attribute__((__cdecl__))"
                    ],
                    "browse": {
                        "path": [
                            "C:/MinGW/lib/gcc/mingw32/5.3.0/include",
                            "C:/MinGW/lib/gcc/mingw32/5.3.0/include-fixed",
                            "C:/MinGW/include/*"
                        ],
                        "limitSymbolsToIncludedHeaders": true,
                        "databaseFilename": ""
                    }
        }
    ],
    "version": 3
}

@NikoGP
Copy link
Author

NikoGP commented Sep 20, 2017

Even using the code above @bobbrow VSC still complains and says;
"#include errors detected. Please update your includePath. IntelliSense features for this translation unit (E:\program.cpp) will be provided by the Tag Parser. (9, 1) cannot open source file "iostream" (9, 1)"
in the problems section below my code

Screenshot of output

@bobbrow
Copy link
Member

bobbrow commented Sep 20, 2017

What version of MinGW are you using? In your first post, it looked like you had 6.3.0 in your include path. In your most recent post, it looked like you pasted in include paths for 5.3.0 from our MinGW page.

@NikoGP
Copy link
Author

NikoGP commented Sep 20, 2017

Okay, I think that my problem lies in the fact that I had installed cygwin prior to MingW, and then I incorrectly installed the required packages for MingW to properly function.
Is there somewhere that I can find what packages I need to install for VS Code to work properly with MingW?

@smithalexk
Copy link

I am also having the issue seen by @NikoGP with my Intellisense after upgrading to v0.13.0. When I turned on the "Default" setting on the Intellisense engine, I keep receiving an iostream include path error (see attached files). I'm running MacOS 10.12.6, and have updated the LLVM engine as well.

The error under the iostream include is:
#include errors detected. Please update your includePath. IntelliSense features for this translation unit /pathToProgram/) will be provided by the Tag Parser.
cannot open source file "wchar.h" (dependency of "iostream")

Simple "Hello World" example showing the error:
helloworld_example

My c_pp_properties.json file:
c_pp_properties

@bobbrow
Copy link
Member

bobbrow commented Sep 27, 2017

@smithalexk, for me, this file resides in /usr/include. What does clang -Wp,-v -E -xc -x c++ /dev/null show as your include path? The "includePath" in your c_cpp_properties.json file should match that.

@smithalexk
Copy link

Yep that looks to have fixed it. Thanks for the help!

For reference, I was missing:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks

@dorsa1986
Copy link

I'm new at coding, I installed Visual Studio code to code in c++ based on the instructions of https://code.visualstudio.com/docs/languages/cpp, after following all steps, I got a lot of error.

screen shot 2017-09-29 at 3 58 45 pm

my c_cpp_properties.json file:

screen shot 2017-09-29 at 4 04 25 pm

My tasks.json file:

screen shot 2017-09-29 at 4 06 27 pm

My launch.json file:

screen shot 2017-09-29 at 4 22 52 pm

My User Setting is:

screen shot 2017-09-29 at 4 15 53 pm

The path of the FirstProg folder is :

screen shot 2017-09-29 at 4 17 15 pm

@bobbrow
Copy link
Member

bobbrow commented Oct 2, 2017

@dorsa1986, what does g++ -Wp,-v -E -xc -x c++ /dev/null show as your include path? The "includePath" in your c_cpp_properties.json file should match that.

@smithalexk
Copy link

Hi @dorsa1986, I also noticed that you spelled "iostream" incorrectly. You are currently including the "ioastream" header. That looks like it could be causing your error.

@dorsa1986
Copy link

@smithalexk Thanks, I corrected but still, I got error

screen shot 2017-10-02 at 9 25 07 am

@dorsa1986
Copy link

@bobbrow they matched.

screen shot 2017-10-02 at 9 27 57 am

@bobbrow
Copy link
Member

bobbrow commented Oct 2, 2017

According to that error, either your tasks.json is not building your program correctly, or your launch.json has an incorrect path to the built program. But this is not an issue with IntelliSense. I don't see any red squiggles in your editor.

@dorsa1986
Copy link

how can I solve them?

@bobbrow
Copy link
Member

bobbrow commented Oct 2, 2017

Open tasks.json or launch.json (in the .vscode folder) and verify that they are correct

@dorsa1986
Copy link

it's my launch.jason file:

screen shot 2017-10-02 at 9 38 59 am

@dorsa1986
Copy link

This is my tasks.json:

screen shot 2017-10-02 at 9 40 40 am

I've been working on this about 4 days. I can't find my mistake.

@bobbrow
Copy link
Member

bobbrow commented Oct 2, 2017

Based on what I see in your previous posts, I'm going to guess that the path should be /Users/dorsat/Desktop/FirstProg/a.out

@dorsa1986
Copy link

I got the same error.

@bobbrow
Copy link
Member

bobbrow commented Oct 2, 2017

Did you build it yet? Open your terminal or a Finder window and tell me where your compiled program lives.

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Oct 2, 2017

@dorsa1986 Is a.out the name of the executable? Does it have executable permissions? Can you run it without VS Code from a command line?

@bobbrow
Copy link
Member

bobbrow commented Oct 2, 2017

There should be plenty of websites out there that can walk you through the steps of getting your code to build. This forum is for troubleshooting bugs in the VS Code Extension and your issue doesn't appear to be a bug since it doesn't appear to work for you in the terminal either.

I'm running out of ideas for you, but these came to mind:

  • Check your filesystem to make sure the headers are there (look at the include paths that your compiler tells you it's using)
  • Did you install XCode, or run xcode-select --install?
  • Did you install a different compiler you can try? (your tasks.json references g++, but your terminal screenshots show cpp)
  • It looks like you have an a.out in your folder already. How did you get it?

@perryizgr8
Copy link

I am trying to solve the same error "#include errors detected. Please update your includePath. IntelliSense features for this translation unit will be provided by the Tag Parser.'" and "cannot open source file "iostream"".

I have followed all the suggestions in this thread and now my browse.path and includePath are same as the entries found using "g++ -Wp,-v -E -xc -x c++ /dev/null".

However, I still cannot include iostream or atomic or stdio, basically any standard header. My own headers from a sub-directory are fine.

To be clear, mine is not a build issue (I'm using my own build system), but an intellisense issue. A peculiarity is that my code resides on a remote Ubuntu server, and I am running VS code on my Windows laptop with the Z: drive mounted to / on the server. I'd be grateful if anybody has any ideas.

Thanks.

@bobbrow
Copy link
Member

bobbrow commented Oct 10, 2017

Can you share the include path given by g++? Is it the path on the Ubuntu server or the mapped location on Windows? The includePath needs to match the filesystem of the OS you're working on (in this case Windows with the Z: path).

@perryizgr8
Copy link

This is the output of the g++ command on the Ubuntu machine:

ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/5
/usr/include/x86_64-linux-gnu/c++/5
/usr/include/c++/5/backward
/usr/lib/gcc/x86_64-linux-gnu/5/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
# 1 "/dev/null"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "/dev/null"

I have / mounted to drive letter Z, so my includePath looks like this:

        "includePath": [
            "z:\\usr\\include\\",
            "z:\\usr\\include\\linux\\",
            "z:\\usr\\include\\x86_64-linux-gnu\\",
            "z:\\usr\\include\\x86_64-linux-gnu\\c++\\5\\",
            "z:\\usr\\include\\x86_64-linux-gnu\\5\\include\\",
            "z:\\usr\\include\\x86_64-linux-gnu\\5\\include-fixed\\",
            "z:\\usr\\bin\\..\\lib\\gcc\\x86_64-linux-gnu\\5.4.0\\..\\..\\..\\..\\include\\c++\\5.4.0\\",
            "z:\\usr\\bin\\..\\lib\\gcc\\x86_64-linux-gnu\\5.4.0\\..\\..\\..\\..\\include\\x86_64-linux-gnu\\c++\\5.4.0\\",
            "z:\\usr\\bin\\..\\lib\\gcc\\x86_64-linux-gnu\\5.4.0\\..\\..\\..\\..\\include\\c++\\5.4.0\\backward\\",
            "z:\\usr\\include\\c++\\5\\",
            "z:\\usr\\include\\c++\\5\\backward\\",
            "z:\\usr\\local\\include\\",
            "z:\\path\\to\\my\\own\\includes\\"
        ],

As you can see, I have translated each path to the equivalent path on my Windows system. I can access the headers using these paths in Windows Explorer, so the path is correct. So even though I can open the iostream header by navigating to "z:\usr\include\x86_64-linux-gnu\c++\5" and opening the file in any editor, VS code still shows a green squiggle below its include.

I am accessing the server over the internet, so I'm worried this might have something to do with VS code being unable to parse files that are slow to read. Is that likely to cause this problem? The fire icon in the bottom right does go away after a while (1-2 min).

Thanks for responding.

PS: Sorry for the inconsistent formatting.

@1st
Copy link

1st commented Oct 26, 2017

Hello. As @smithalexk said above, the C++ extension doesn't work by default. But when I've added these 3 lines (see below) - all becomes working.

{
            "includePath": [
                // - 1st -
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include"
                // ...
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    // - 2nd -
                    "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include",
                    // ...
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "macFrameworkPath": [
                // - 3rd -
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks",
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ]
}

Can you please make these changes to the plugin to make people on Mac happy? Thank you.

@grigosback
Copy link

Hello , I'm having problems with #Includes when I'm coding in C, my c_cpp_properties.json:

{

"configurations": [{
    "name": "Win32",
    "intelliSenseMode": "clang-x64",
    "includePath": [
        "${workspaceRoot}",
        "C:\\MinGW\\lib\\gcc\\mingw32\\6.3.0\\include",
        "C:\\MinGW\\include",
        "C:\\MinGW\\lib\\gcc\\mingw32\\6.3.0\\include-fixed"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "__GNUC__=6",
        "__cdecl=__attribute__((__cdecl__))"
    ],
    "browse": {
        "path": [
            "C:\\MinGW\\lib\\gcc\\mingw32\\6.3.0\\include",
            "C:\\MinGW\\lib\\gcc\\mingw32\\6.3.0\\include-fixed",
            "C:\\MinGW\\include\\*"
        ],
        "limitSymbolsToIncludedHeaders": true,
        "databaseFilename": ""
    }
}],
"version": 3

}

The error I've got:

image

My 'gcc -v -E -x c' output:

Using built-in specs.
COLLECT_GCC=C:\MinGW\bin\gcc.exe
Target: mingw32
Configured with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --with-gmp=/mingw --with-mpfr --with-mpc=/mingw --with-isl=/mingw --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --enable-libgomp --disable-libvtv --enable-nls
Thread model: win32
gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)
COLLECT_GCC_OPTIONS='-v' '-E' '-mtune=generic' '-march=i586'
 c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/cc1.exe -E -quiet -v -iprefix c:\mingw\bin\../lib/gcc/mingw32/6.3.0/ - -mtune=generic -march=i586
ignoring nonexistent directory "c:\mingw\bin\../lib/gcc/mingw32/6.3.0/../../../../mingw32/include"
ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/6.3.0/include"
ignoring duplicate directory "/mingw/lib/gcc/mingw32/6.3.0/../../../../include"
ignoring duplicate directory "c:/mingw/lib/gcc/../../include"
ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/6.3.0/include-fixed"
ignoring nonexistent directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/6.3.0/../../../../mingw32/include"
ignoring duplicate directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 c:\mingw\bin\../lib/gcc/mingw32/6.3.0/include
 c:\mingw\bin\../lib/gcc/mingw32/6.3.0/../../../../include
 c:\mingw\bin\../lib/gcc/mingw32/6.3.0/include-fixed
End of search list.

My "INCLUDE" files are in c:/MinGW/include/

Thank you!

@sean-mcmanus
Copy link
Collaborator

@grigosback The 'stdio.h' file not found message is not from our extension. Another user hit this same issue: #1203 .

@grigosback
Copy link

That was the problem @sean-mcmanus, I don't know why I had the C/C++ Clang Command Adapter, I uninstalled it and now I don't have that message anymore. Thanks a lot!

@bobbrow
Copy link
Member

bobbrow commented Nov 16, 2017

We recently updated the way the extension searches for default includes. This issue forked into a bunch of other issues so if we missed anything and you are still having problems, please open a new issue.

@bobbrow bobbrow closed this as completed Nov 16, 2017
@codercodingthecode
Copy link

still does not work. but that is a way of running from it.

@bobbrow
Copy link
Member

bobbrow commented Nov 20, 2017

@andythedandyone, please open a new issue and we'll be happy to investigate.

@mohamedotnet
Copy link

@andythedandyone: kindly, go to settings.json and set "C_Cpp.intelliSenseEngine" from "Default" to
"Tag Parser"

@Ladinstar
Copy link

Hello here ! I have the same problem but i use codeblocks in windows to compile. Help me please !

@sean-mcmanus
Copy link
Collaborator

@Ladinstar Can you provide more repro info, preferably in a new issue: https://github.com/Microsoft/vscode-cpptools/issues/new .

@Ladinstar
Copy link

thank you i have founded the solution !

@admercs
Copy link

admercs commented May 29, 2018

Note to MacOS users, if you are using gcc version 8.1.0 (for example) from Homebrew, your MacOS configuration should look like this:

{
    "name": "Mac",
    "browse": {
        "path": [
            "${workspaceRoot}"
        ],
        "limitSymbolsToIncludedHeaders": true
     },
     "includePath": [
         "${workspaceRoot}/**",
         "/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0",
         "/usr/local/Cellar/gcc/8.1.0/include/c++/8.1.0/x86_64-apple-darwin16.7.0"
     ],
     "defines": [],
     "compilerPath": "/usr/local/Cellar/gcc/8.1.0/bin/gcc-8",
     "cStandard": "c11",
     "cppStandard": "c++17",
     "intelliSenseMode": "clang-x64"
}

Very simple. You do not need to include headers from XCode. Do not set compilerPath to /usr/local/bin/gcc-8, as this is a symbolic link that may mess up IntelliSense. If you are still having issues as I did, set the following user setting in settings.json as others have to get around a recent issue: "C_Cpp.intelliSenseEngine": "Tag Parser",

@prdas31
Copy link

prdas31 commented Aug 12, 2018

What include files needed to run my code using cl.exe from MSVS 2015?

I've included these folders in c_cpp_properties.json:

"C:/Program Files (x86)/Windows Kits/8.1/Include/shared",
"D:/Program Files (x86)/Microsoft Visual Studio/2017Community/VC/include",
"D:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/*",
"D:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.13.26128/include",
"D:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt",
"D:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/include",
"D:/Program Files (x86)/Mirucrosoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/atlmfc/include",
"D:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/crt/src/x64",

But still I get an error while try to build:

> Executing task: & 'D:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/bin/Hostx64/x64/cl.exe' 'h:\C++ Programs\ExBox01.cpp' <

Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26128 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

ExBox01.cpp
h:\C++ Programs\ExBox01.cpp(2): fatal error C1034: iostream: no include path set
The terminal process terminated with exit code: 1

@sean-mcmanus
Copy link
Collaborator

@adam-erickson There's a crashing bug with gcc 8.1 you may be hitting (#2328 ) -- our latest insider release has the fix: https://github.com/Microsoft/vscode-cpptools/releases/tag/v0.17.8-insiders .

@prdas31 Our extension doesn't currently support any build features -- the c_cpp_properties.json is for the IntelliSense feature and not actual compiling. For building with MSVS 2015, you may need to build from the developer command prompt that ships with VS.

@prdas31
Copy link

prdas31 commented Aug 15, 2018

@prdas31 Our extension doesn't currently support any build features -- the c_cpp_properties.json is for the IntelliSense feature and not actual compiling. For building with MSVS 2015, you may need to build from the developer command prompt that ships with VS.

Thanks a lot for the clarification and suggestion. I now use build files to include the paths like this:

if exist "D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" (
    call "D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
) else (
    call "D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
)

This idea is taken from an VSCODE extension called Easy C/C++ Project.

Thanks.

@leslienguyn
Copy link

leslienguyn commented Sep 29, 2018

[issue moved]

@bobbrow
Copy link
Member

bobbrow commented Oct 1, 2018

@leslienguyn, I moved your issue to #2582. This issue is closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests