Created a project in eclipse Juno Hello World Autotools C ++ Project. Removed an unnecessary part from it and inserted its program into it.
#include <iostream> //using namespace std; #include <stdio.h> #include <postgresql/libpq-fe.h> #include <string> #include <cstdio> #include <stdlib.h> #include <libc.h> int main() { PGconn *conn; PGresult *res; int rec_count; int row; int col; FILE *stream; conn = PQconnectdb("hostaddr=192.168.143.93 port=5432 connect_timeout=5 dbname=NexentaSearch user=DKOI password=21111991"); if (PQstatus(conn) == CONNECTION_BAD) { puts("Не удается подключиться к базе данных"); exit(0); } res = PQexec(conn, "select path from paths order by id"); if (PQresultStatus(res) != PGRES_TUPLES_OK) { printf("Мы не получили данные"); exit(0); } rec_count = PQntuples(res); printf("Мы получили %d записей.\n", rec_count); puts("=========================="); stream=fopen("usr/local/ paths.txt ", "w"); for (row=0; row<rec_count; row++) { for (col=0; col<1; col++) { fprintf(stream, "%s\n", PQgetvalue(res, row, col)); } puts(""); } puts("=========================="); PQclear(res); PQfinish(conn); return 0;
}
When compiling (clicking on a hammer, Build 'Build (GNU)' for project readwritepaths) produces the following errors:
Error 127 occurred while running autoreconf readwritepaths -1 Configure Problem
Programg g ++ not found in PATH readwritepaths
Programg gcc not found in PATH readwritepaths