gpt4 book ai didi

c - 如何在 include 语句中包含

转载 作者:太空宇宙 更新时间:2023-11-04 06:07:44 24 4
gpt4 key购买 nike

我想在我的程序中包含一个文件 say a.h,它位于某个位置,例如 (/ws/uname/bd/lib) & 该文件又具有不同的 include 语句,其文件位于截然不同的位置。我如何通过仅包含带有“/ws/uname/bd/lib/a.h”的文件来做到这一点。我不想更改任何头文件。

感谢您的帮助

最佳答案

你用的是什么编译器?如果是clang或者gcc,可以使用-I标志来添加头文件的搜索路径。来自gcc(1) man page :

-Idir

Add the directory dir to the head of the list of directories to be searched for header files. This can be used to override a system header file, substituting your own version, since these directories are searched before the system header file directories. However, you should not use this option to add directories that contain vendor-supplied system header files (use -isystem for that). If you use more than one -I option, the directories are scanned in left-to-right order; the standard system directories come after.

关于c - 如何在 include 语句中包含,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6377755/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com