Search code examples
c++vimiostream

E447: Can't find file "iostream" in path


I'm currently using Vim. To open iostream I go over it with cursor and type in g f. After that in the bottom of the screen I get this message: E447: Can't find file "iostream" in path. (All of my files .cpp files work perfectly fine)


Solution

  • gf looks up the filename under the cursor in the directories specified in the path option. By default (on unix systems), the path option is set to .,/usr/include,,. This default is not sufficient to find C++ standard library headers directly.

    In order to make gf find the C++ standard library headers, you can add the /usr/include/c++/<version>/ directory to path, e.g. like so:

    :set path=.,/usr/include,,/usr/include/c++/*/