Ive got the newest ubuntu and I
ve done:
sudo apt-get install postgresql postgresql-contrib
sudo apt-get install libpqxx-4.0v5
sudo apt-get install libpqxx-dev
I can`t compile program which uses pqxx::tuple.
Compilation:
g++ test.cpp -I/usr/local/include/ -lpqxx -lpq
or
g++ test.cpp -lpqxx -lpq -o test
Console output:
test.cpp: In function ‘int main()’:
test.cpp:15:21: error: ‘tuple’ in namespace ‘pqxx’ does not name a type
const pqxx::tuple row = r[rownum];
This is the problematic line:
const pqxx::tuple row = r[rownum];
When I remove this line, program works correctly.
#include <iostream>
#include <pqxx/pqxx>
int main()
{
try {
pqxx::connection c("dbname=mydb user=postgres port=5432 password=*** hostaddr=127.0.0.1");
pqxx::work w(c);
pqxx::result r = w.exec("SELECT * FROM get_player_data_function()");
w.commit();
const int num_rows = r.size();
for (int rownum=0; rownum < num_rows; ++rownum) {
const pqxx::tuple row = r[rownum];
}
}
catch (const std::exception &e) {
std::cerr << e.what() << std::endl;
}
}
Not sure... but if I understand correctly this page, you have to substitute pqxx::tuple
with pqxx::row
.
So, I suppose
const pqxx::row row = r[rownum];