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 的标头路径更改


基础教程推荐
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- 常量变量在标题中不起作用 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01