更新时间:2023-02-05 10:30:16
搜索路径中的相对路径 参考使用 #include
指令编译器的当前目录文件的目录,现在显示一些简单的测试。
Relative paths in the search paths refer to the directory of the file with the the current directory of the compiler, some simple testing now shows.#include
directive
.. \ ..从你的头文件升级到编译器的当前目录而不是你的项目目录。
"..\.." is going up two levels from your header file the current directory of the compiler instead of from your project directory.
要解决此问题,请在Visual Studio项目目录中显式启动包含路径,如下所示(字面意思):
To fix this, explicitly start your include paths in your Visual Studio project directory, as follows (literally):
$(ProjectDir).. \ ..; $(ProjectDir).. \..\BoostXXX
$(ProjectDir)..\..;$(ProjectDir)..\..\BoostXXX
关于正斜杠和反斜杠,在C ++代码的 #include
指令中使用正斜杠,因为这是最便携的。
Regarding forward versus backward slash, use forward slash in your C++ code's #include
directives, because that's most portable.
使用向前或向后斜杠(但我更喜欢向后斜杠以便有一个转换你指的是Windows文件系统,例如在包含路径的设置中。
Use either forward or backward slash (but I prefer backwards slash so as to have a single convention) where you're referring to the Windows file system, such as in the setup of include paths.