vindyz
vindyz

Reputation: 1101

how to do include within include statement

I wanted to include a file say a.h in my program which is located at some location say (/ws/uname/bd/lib) & that file in turn has different include statements whose files are located in vastly different locations. How can i do that by just including the file with "/ws/uname/bd/lib/a.h". I dont want to change any of the header file.

Appreciate your help

Upvotes: 0

Views: 130

Answers (1)

Carl Norum
Carl Norum

Reputation: 225162

What compiler are you using? If it's clang or gcc, you can use the -I flag to add search paths for header files. From the 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.

Upvotes: 5

Related Questions