In your .c
file, you can use relative path to include the .h
file. For example, if .c
file is in /d/e/f/g
folder and .h
file is in /a/b/c
folder, then your #include
statement has to be
#include "../../../../a/b/c/mysql.h"
This 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 .h
file, and use -I <dir>
flag where you replace <dir>
with the path to the folder that has .h
file. If you move the folders around, you can just change a bit in the the compilation command (usually in a makefile).