The interfaces discussed so far have been based on C or C++. Each interface requires certain include and library files to generate an executable version of the program.
Interface include files are typically installed in /usr/local/pgsql/include. The compiler flag -I is needed to ensure that the compiler searches the specified directory for include files --for example, -I/usr/local/pgsql/include.
Interface libraries are typically installed in /usr/local/pgsql/lib. The compiler flag -L is needed to ensure that the compiler searches the directory for library files --for example, -L/usr/local/pgsql/lib.
The compiler flag -l is needed for the compiler to link to a specific library file. To link to libpq.a or libpq.so, the flag -lpq is needed. Because the -l flag knows that the file begins with lib, -llibpq is not correct--just -lpq.
The commands to compile myapp for various interfaces are listed below: