Kweldulf Kweldulf - 1 year ago 79
C++ Question

Cannot open include file, despite aforementioned file exists

I have a header file include like this:

#include "gnuplot-iostream.h"

but it couses 37 errors like in the title. The errors are coused by includes from the headers from boost++ included like this:

#include <boost/iostreams/device/file_descriptor.hpp>

And obviously I can change the including syntax form <> to "" in ich and every include but there are over a hundred of them, and I don't know why the compiler doesn't search for the header file in the source location although it should. I'm using Visual Studio 2015. How to make the compiler search the source location first.
I have a correct path file. I checked it a few times, and when I right click on the path in IDE and click on show file option it opens the exact file it points to. And changing from <> to "" works, but I want to know a better way to do it.

Answer Source

For Visual Studio, the <> tells the compiler not to look in the source location. You can find more information here.

I think you have several possibilities:

  • Add the boost library path to your additional include directories.
  • Add . to your additional include directories.
  • Change the <> for "" (not recommended because you will have to change it whenever you update your sources).