Possible Duplicate:
How do I add a directory to C header include path?
I would like to set an include path for my mysql.h file which is located in another location, such as: "root/a/b/c".
I’ve tried:
#include "/a/b/c/mysql.h"
But it doesn’t compile. Am I missing an option?
In your
.cfile, you can use relative path to include the.hfile. For example, if.cfile is in/d/e/f/gfolder and.hfile is in/a/b/cfolder, then your#includestatement has to beThis is acceptable if the number of slashes is around 1 or 2 (2 is a bit dirty already). And it is not good if you move the folders around later.
Alternatively, you can only specify the name of the
.hfile, and use-I <dir>flag where you replace<dir>with the path to the folder that has.hfile. If you move the folders around, you can just change a bit in the the compilation command (usually in a makefile).