ecpg can find EXEC SQL INCLUDE header files just fine when run from the directory containing the source, but not from any other directory.
Here is an illustration. Successful compile:
> ecpg -o dbconnect.c dbconnect.pgc
Missing include parameter so expected to fail:
> cd ..
> ecpg -o src/dbconnect.c src/dbconnect.pgc
src/dbconnect.pgc:28: ERROR: could not open include file "vet_config.h" on line 28
Add ecpg include parameter. Still fails:
> ecpg -I src -o src/dbconnect.c src/dbconnect.pgc
src/dbconnect.pgc:28: ERROR: could not open include file "vet_config.h" on line 28
I've tried specifying the absolute path to the src directory. No improvement.
I'm aware that the -o is not necessary.
I'm using PostgreSQL 9.2. Here is the version information from ecpg:
> ecpg -v -I src -o src/dbconnect.c src/dbconnect.pgc
ecpg, the PostgreSQL embedded C preprocessor, version 4.8.0
EXEC SQL INCLUDE ... search starts here:
src
.
/usr/local/include
/usr/pgsql-9.2/include
/usr/include
end of search list