How to add multiple header include and library directories to the search path in a single gcc command?
To specify multiple search path directories on the command line, the options -I and -L can be repeated. For example, the following command, $ gcc -I. -I/opt/gdbm-1.8.
GCC looks for headers requested with #include " file " first in the directory containing the current file, then in the directories as specified by -iquote options, then in the same places it would have looked for a header requested with angle brackets. For example, if /usr/include/sys/stat. h contains #include "types.
it's simple, use the "-B" option to add . h files' dir to search path. Show activity on this post. Headers included with #include <> will be searched in all default directories , but you can also add your own location in the search path with -I command line arg.
We no longer need to include the system header file 'stdio. h' in 'main.
Use multiple -I flags for the include directories and multiple -L flags for the lib directories
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With