简体   繁体   中英

g++ compile using custom header file

I want to use a header file, its included as #include <custom.h>

how can I compile it by using the custom.h header file ?

I tried -I /path/to/custom.h , but its giving me error that its not a directory..

-I /path/to

This will enable all headers in that directory to be found.

In man gcc, search (using / in your pager) for "-I dir":

-I dir

Add the directory dir to the list of directories to be searched for header files. Directories named by -I are searched before the standard system include directories. If the directory dir is a standard system include directory, the option is ignored to ensure that the default search order for system directories and the special treatment of system headers are not defeated. If dir begins with "=", then the "=" will be replaced by the sysroot prefix; see --sysroot and -isysroot.

实际上, /path/to/custom.h不是目录,而是文件。

-I/path/to/custom/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM