Find the path of the STL headers used by g ++

I need to look at something in the debug version of std::vector<T> , and I can’t remember where the headers are. This is under MSYS on Windows, where it is complicated because you have /include , /mingw/include , /mingw/mingw32/include , /usr/include , and I still cannot find them ...

I know one way, that is, write a file like this:

 #include <vector> int main() { return 0; } 

Then

 $ g++ -E temp.cpp | grep vector 

And we find it here: /mingw/lib/gcc/mingw32/4.8.1/include/c++/vector

But is there a faster way? Can we ask g++ without using this trick?

+7
c ++ gcc stl msys g ++
source share
1 answer

You can display the full search paths using

 g++ -print-search-dirs 

or you can find a specific header without writing the source file with something along the lines

 echo '#include <vector>' | g++ -x c++ -E - | grep '/vector"' 
+8
source share

All Articles