Compiling C code with CPPFLAGS with multiple directories

To define multiple includes in your CPPFLAGS, just do,

CPPFLAGS="-I/usr/include -I/opt/local/include -I/usr/local/include"

Clearly, put the path inside the "double quoted" flag value.

This can be included like when you compile a package, let say for example, compiling with "configure", you can,


$> ./configure --prefix=/usr/local

$> make CPPFLAGS="-I/usr/include -I/opt/local/include -I/usr/local/include -I/usr/include/malloc"

$> make install


where it includes and specify a malloc header looks for /usr/include/malloc/malloc.h for example, so you'll just use the base directory, which is /usr/include/malloc.


Comments

Popular posts from this blog

Converting sectors into MB - Useful in understanding the sectors in iostat in Linux

What is Disk Contention?

Installing MySQL from source: Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)