让GCC预处理器将尖括号当作引号

时间:2018-08-28 09:32:54

标签: g++ c-preprocessor hdf5 gcc7

我正在尝试使用系统标头,这些标头使用应该使用引号的尖括号。具体来说,我在/ usr / include / hdf5 / serial /中有一个系统提供的头文件,其中包含

#include <hdf5.h>

我当然可以将选项 -isystem / usr / include / hdf5 / serial 传递给G ++,但是我宁愿保持模块化,也不要将此配置复制到任何可以最终使用此标头。

我在Ubuntu 18.04和带有DevToolset 7的CentOS 7.x上使用G ++ 7.3。

1 个答案:

答案 0 :(得分:1)

您提出的是唯一明智的解决方案-库要求您将该目录添加到编译器的system-includes路径中。为了使用头文件将其与程序隔离,您可以只从库中向前声明所需的内容,或者可能需要某种抽象层。或者只是将库的32 Number of Characters..... 2 ---------------- 32 ------------------ ULL...................... 32 Bits..................... 8 Binary Value............. 00100000 3a2 Number of Characters..... 3 Number: 3 ---------------- 3 ------------------ ULL...................... 3 Bits..................... 8 Binary Value............. 00000011 Letter: a ---------------- a ------------------ ASCII Value of a......... 97 Number: 2 ---------------- 2 ------------------ ULL...................... 2 Bits..................... 8 Binary Value............. 00000010 6j3 Number of Characters..... 3 Number: 6 ---------------- 6 ------------------ ULL...................... 6 Bits..................... 8 Binary Value............. 00000110 Letter: j ---------------- j ------------------ ASCII Value of j......... 106 Number: 3 ---------------- 3 ------------------ ULL...................... 3 Bits..................... 8 Binary Value............. 00000011 转发到您自己库的pkg-config文件中。