problem whith libpq

Поиск
Список
Период
Сортировка
Искать

problem whith libpq

От:
loic lecoeur <loleco666@yahoo.fr>
Дата:
I am a french student and i must do a sql database
witch interract with a vxworks system.

My solution is to use a client/serveur in C and a sql
database controled by a C program
Is it the best solution??
if no what is it?
if yes,i wrote a test program in c but it doesn't
work.
he is based on your example "sample program" at the
end of the chapter 16 of your documentation
can you tell me why i can't compile it ?
there is all the code of the application here
If you can't help me , can you give me a place or mail
of persons who can help me ?
Thank you :)

//command for postmaster

postmaster -i -p 12032 -D /home/magic/db

//source code of the test application testpqlib.c:

#include 
#include 



void exit_nicely(PGconn *conn)
{
	PQfinish(conn);
	exit(1);
}


main()
{
	char 		*pghost,
	        	*pgport,
			*pgoption,
			*pgtty,
			*dbname;
	PGconn		*conn;
	PGresult	*res;
	char toto[]="12032";	

	/*initialisation des parametres de la connection*/
	pghost=NULL;
	pgport=toto;
	pgoption=NULL;
	pgtty=NULL;
	dbname="projet";
	/*etablissement de la connection*/
	conn=PQsetdb(pghost,pgport,pgoption,pgtty,dbname);
	/*test de la connection a la bdd*/
	if (PQstatus(conn)==CONNECTION_BAD)
	{
		printf("connection échouée");
		printf("%s",PQerrorMessage(conn));
		exit_nicely(conn);
	}
	exit_nicely(conn);
}

//command for compilation

gcc testpqlib.c -o testpqlib

//output errors of the compilator:

[magic@profs testsdivers]$ gcc testpqlib.c -o
testpqlib
/tmp/ccmMWakA.o: In function `exit_nicely':
/tmp/ccmMWakA.o(.text+0x8): undefined reference to
`PQfinish'
/tmp/ccmMWakA.o: In function `main':
/tmp/ccmMWakA.o(.text+0x88): undefined reference to
`PQsetdbLogin'
/tmp/ccmMWakA.o(.text+0x99): undefined reference to
`PQstatus'
/tmp/ccmMWakA.o(.text+0xb9): undefined reference to
`PQerrorMessage'

loic lecoeur
Caen (France)
___________________________________________________________
Do You Yahoo!?
Achetez, vendez! À votre prix! Sur http://encheres.yahoo.fr
FAQ