Reputation: 171
I am trying to use xtensor for the first time in Visual Studio 2019 and I get errors like 'cannot open source file "xtl/xsequence.hpp".
The folder 'xtl' is correctly located in the directory. In the file, it is written #include <xtl/xsequence.hpp>
and the error goes away when I change it to #include "xtl/xsequence.hpp"
. I could just change it, but the error happens 73 times throughout the other files. Is there any way to fix with without making 73 separate changes?
Here is what I've done so far:
The original issue that appears many times.
The fix involves changing <> to "".
The location of the xtl
What I've tried to do so far.
A snapshot of the types of errors that still show up.
Upvotes: 0
Views: 725
Reputation: 4040
The angle brackets cause the preprocessor to search the directories specified by the INCLUDE environment variable for .H.The double quotation marks mean that the preprocessor searches the directory containing the parent source file first.
The compiler searches directories in the following order:
1,If specified using a #include directive in double-quote form, it first searches local directories. The search begins in the same directory as the file that contains the #include statement. If this fails to find the file, it searches in the directories of the currently opened include files, in the reverse order in which they were opened. The search begins in the directory of the parent include file and continues upward through the directories of any grandparent include files.
2,If specified using a #include directive in angle bracket form, or if the local directory search has failed, it searches directories specified by using the /I option, in the order that CL encounters them on the command line.
3,Directories specified in the INCLUDE environment variable.
I suggest you could try to add the path of the xtl/xsequence.hpp file to the Additional Include Directories(property ->c/c++ -> General -> Additional Include Directories)
Upvotes: 0
Reputation: 19767
There is a technical distinction between what The Standard calls headers, which are things the Standard Library provides, and are included using <>
, and source files, which are used for other libraries, and are included using ""
.
In practice, all it really means is that <>
looks in a specified set of directories, whereas ""
looks first in the local directory. You can add a directory for <>
to check using a compiler option. For msvc, that option is /I
.
Upvotes: 2