Vscode-cpptools: Bug with the head file bits/stdc++.h

Created on 25 May 2017  路  7Comments  路  Source: microsoft/vscode-cpptools

When I use the header file bits/stdc++.h, cpptools always tells me that it should be added to include path
However, I have already include the directory where stdc++.h is and also the directory where files included in stdc++.h are. And they cause the intellisense engine go wrong.
It seems that when it is in cpptools, it is looking for a header file called "bits\stdc++.h" ,which is not allowed in windows because of the char "\"
It is not possible for me to copy the stdc++.h to another place and use stdc++.h because I have to submit my code and I don't want to cause trouble because of it.
So my suggestion is that cpptools should ignore file name before the char "\" and only look for the correct name of it.
Another possible solution is that adding a feature that can make cpptools know where the exact file. When it met the header, it can use the directory set in cpp_properties.json.
//cpptools 0.11.2 MinGW 6.3.0

Language Service

Most helpful comment

I found a way to deal with this problem. We have to modify files in MinGW
Copy
C:/Program Files/MinGW64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32/bits/stdc++.h
to
C:/Program Files/MinGW64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/bits

And finally don't forget to add
C:/Program Files/MinGW64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++
and
C:/Program Files/MinGW64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/bits
to your include path

All 7 comments

I found a way to deal with this problem. We have to modify files in MinGW
Copy
C:/Program Files/MinGW64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32/bits/stdc++.h
to
C:/Program Files/MinGW64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/bits

And finally don't forget to add
C:/Program Files/MinGW64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++
and
C:/Program Files/MinGW64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/bits
to your include path

You shouldn't need to make a copy of the file. Just add C:/Program Files/MinGW64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/x86_64-w64-mingw32 to your includePath.

Adding the "bits" folder should not be needed. Any header in the CRT that needs to include a header from that folder will include it as \

I wrote a doc with some guidance for MinGW users. Let us know if that does not resolve you issue.

How can I include the header file in path in Linux (Ubuntu)?

@baymac Can you try setting your compilerPath and removing any system includes from includePath? You can use C/C++: Log Diagnostics to check that the system includes are correctly getting queried.

@ret394 We would accept your help updating the docs. Feel free to click the "Edit" button at the top and submit a PR back to the docs team.

And if you are asking for additional docs/work, please open a new issue. We will lose track of the request because you posted to a closed issue.

Thank you.

@ret394 What does https://github.com/microsoft/vscode-cpptools/issues/6333 have to do with this issue?

Was this page helpful?
0 / 5 - 0 ratings