Teruel Tony wrote:
  >Hi,
  >
  >I'm interacting with postgeSQL using C languaje,
  >I'm having compilation problems.
  >I set the compilation definition as:
  >PGSQL_INCLUDE=/usr/local/pgsql/include/libpq
  >
  >(that's where I got the path to libpq)
  >and I'm using something like this (I'm using
  >sockets) to compile:
  >
  >cc -s -I/usr/local/pgsql/include -L/usr/local/pgsql/lib program.c -lm -lnsl
  >-o program.exe
  >
  >By the way I'm using Linux. I got the following error:
  >
  >/tmp/ccgtGrLd.o: In function `test':
  >/tmp/ccgtGrLd.o(.text+0xa): undefined reference to `PQerrorMessage'
  >/tmp/ccgtGrLd.o(.text+0x2e): undefined reference to `PQfinish'
  >and so on....
  >
  >Can someone help? What am I doing wrong?

cc -s -I/usr/local/pgsql/include -L/usr/local/pgsql/lib program.c -lpq -lm -lnsl -o 
program.exe
                                                              add ^^^^ this

You failed to tell it to link libpq.


-- 
Oliver Elphick                                [EMAIL PROTECTED]
Isle of Wight                              http://www.lfix.co.uk/oliver
               PGP key from public servers; key ID 32B8FAA1
                 ========================================
     "Trust in the Lord with all your heart and lean not on 
      your own understanding; in all your ways acknowledge  
      him, and he will direct your paths."  Proverbs 3:5,6  


Reply via email to