This is my first attempt at using libpq, and I'm running across a strange
problem. Here is my bare-bones program:
#include
#include "libpq-fe.h"
int main(int argc, char **argv) {
PGconn *conn;
fprintf(stderr, "connecting\n");
conn = PQconnectdb("dbname=postgres");
PQfinish(conn);
retur
Aurimas Černius wrote on Wed, Feb 18, 2009 at 05:01:14PM
+0200:
> Did you use *exactly* the same command line to compile both versions?
> What is that command line(s)?
Yes, I used the same compilation command line for both versions:
gcc -o pq_test -I"C:\Program Files\PostgreSQL\8.3\include" -L"
> How do you run the program, in console or by double clicking on
> executable. Try the second. Does the console window apear on the screen?
Aha! This tip has led to the solution. I had been running the program from
an emacs shell buffer. If I run it from the Windows console or by
double-clickin
David Wilson wrote on Wed, Feb 18, 2009 at
11:36:44AM -0500:
> Try adding "fflush(stderr);" after your fprintf() call. If the
> connection is hanging and output hasn't been flushed, you wouldn't see
> much.
No, this doesn't help, either. Thanks for the suggestion.
--
Sent via pgsql-general mai
Aurimas Černius wrote on Wed, Feb 18, 2009 at 06:08:07PM
+0200:
> Libraries should be places after the source file, that is (not sure
> about -L, but for -l surely):
>
> gcc -o pq_test -I"C:\Program Files\PostgreSQL\8.3\include" pq_test.c
> -L"C:\Program Files\PostgreSQL\8.3\lib" -lpq
>
> I d
Lennin Caro wrote on Wed, Feb 18, 2009 at 06:53:32AM
-0800:
> try
> fprintf(stdout,"Connection \n");
> printf("Connection \n");
Thanks, but both produce the same behavior as fprintf(stderr, "Connection \n"):
It prints when the PQconnectdb and PQfinish lines are commented out but not
when they a
This is my first attempt at using libpq, and I'm running across a strange
problem. Here is my bare-bones program:
#include
#include "libpq-fe.h"
int main(int argc, char **argv) {
PGconn *conn;
fprintf(stderr, "connecting\n");
conn = PQconnectdb("dbname=postgres");
PQfinish(conn);
retur