Include header path change from Windows to Linux(包括从 Windows 到 Linux 的标头路径更改)
问题描述
我正在将一个用 C++ 编写的应用程序从 Windows 移植到 Linux.我的头文件路径有问题.Windows 使用 ,Linux 使用
/
.我发现在每个源文件和头文件中更改它很麻烦.有什么解决办法吗?
I'm porting an application written in C++ from Windows to Linux. I have a problem with the header files path. Windows uses and Linux uses
/
. I am finding it cumbersome to change this in each and every source and header file. Is there some work around?
推荐答案
在#include 路径中始终使用正斜杠.将路径映射到底层操作系统支持的任何斜线/目录方案是编译器的工作.
Always use forward slashes in #include paths. It is the compiler's job to map the path to whatever slash/directory scheme the underlying OS supports.
这篇关于包括从 Windows 到 Linux 的标头路径更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:包括从 Windows 到 Linux 的标头路径更改


- Stroustrup 的 Simple_window.h 2022-01-01
- 静态初始化顺序失败 2022-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 近似搜索的工作原理 2021-01-01
- 从python回调到c++的选项 2022-11-16
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- C++ 协变模板 2021-01-01