It was hard to use PostgreSQL, in my opinion. Writing with C++, I saw the errors and got rid of the errors:
/path/to/file/code.c:53: undefined reference to `PQfinish'
/tmp/ccblsFot.o: In function `show_binary_results':
/path/to/file/code.c:72: undefined reference to `PQfnumber'
/path/to/file/code.c:73: undefined reference to `PQfnumber'
/path/to/file/code.c:74: undefined reference to `PQfnumber'
/path/to/file/code.c:85: undefined reference to `PQgetvalue'
/path/to/file/code.c:86: undefined reference to `PQgetvalue'
/path/to/file/code.c:87: undefined reference to `PQgetvalue'
/path/to/file/code.c:103: undefined reference to `PQgetlength'
/path/to/file/code.c:107: undefined reference to `PQgetlength'
/path/to/file/code.c:109: undefined reference to `PQgetlength'
/path/to/file/code.c:76: undefined reference to `PQntuples'
/tmp/ccblsFot.o: In function `main':
/path/to/file/code.c:139: undefined reference to `PQconnectdb'
/path/to/file/code.c:142: undefined reference to `PQstatus'
/path/to/file/code.c:145: undefined reference to `PQerrorMessage'
/path/to/file/code.c:170: undefined reference to `PQexecParams'
/path/to/file/code.c:172: undefined reference to `PQresultStatus'
/path/to/file/code.c:174: undefined reference to `PQerrorMessage'
/path/to/file/code.c:175: undefined reference to `PQclear'
/path/to/file/code.c:181: undefined reference to `PQclear'
/path/to/file/code.c:208: undefined reference to `PQexecParams'
/path/to/file/code.c:210: undefined reference to `PQresultStatus'
/path/to/file/code.c:212: undefined reference to `PQerrorMessage'
/path/to/file/code.c:213: undefined reference to `PQclear'
/path/to/file/code.c:219: undefined reference to `PQclear'
/path/to/file/code.c:222: undefined reference to `PQfinish'
$ g++ -I/usr/local/pgsql/include \
-L/usr/local/pgsql/lib -lpq \
-finput-charset=utf-8 \
-fexec-charset=utf-8 \
-fwide-exec-charset=utf-8 \
-g code.c -o program
Reference:
http://www.mkyong.com/database/how-to-building-postgresql-libpq-programs/
No comments:
Post a Comment