The command pkg-config
outputs a flag to search at the path where the header is (not sure about the library name you must provide: check with your package manager):
$ pkg-config --cflags libmongoc
-I/usr/local/include/libmongoc-1.0/
If you use gcc, your compilation line must look like:
gcc `pkg-config --cflags libmongoc` file.c
If you use an IDE, find the way to provide this for the compilation. This is the best way to do it because if you update the library, or if you give the project to someone with a different emplacement of the headers, your project will keep to compile correctly.
Because you installed the library manually, you must
- either install the
libmongoc.pc
file into the right place (man pkg-config
for more information);
- either put the flag manually:
gcc -I/usr/local/include/libmongoc-1.0 file.c
. The syntax -I/some/path
given to the compiler means: search the header files in this place. Modify the project configuration in the IDE accordingly.