Hallo liebe Community,
Ich beschäftige mich gerade damit libpqxx zu lernen.
folgendes Script:
#include <iostream>
#include <pqxx/pqxx>
int main()
{
try
{
pqxx::connection c(
"user=papa "
"host=localhost "
"password=mama "
"dbname=postgres");
pqxx::work w(c);
for (pqxx::result::const_iterator row = r.begin();
row != r.end();
++row)
{
for (pqxx::result::tuple::const_iterator field = row->begin();
field != row->end();
++field)
std::cout << field->c_str() << '\t';
std::cout << std::endl;
}
w.commit();
std::cout << r[0][0].as<int>() << std::endl;
}
catch (const std::exception &e)
{
std::cerr << e.what() << std::endl;
return 1;
}
}
führt leider zu folgendem Fehler:
g++ KapStart2.cpp -lpqxx -lpq -o zumi
KapStart2.cpp: In function ‘int main()’:
KapStart2.cpp:23:24: error: ‘pqxx::result::tuple’ has not been declared
for (pqxx::result::tuple::const_iterator field = row->begin();
^
KapStart2.cpp:24:10: error: ‘field’ was not declared in this scope
field != row->end();
^
KapStart2.cpp:24:10: note: suggested alternative:
In file included from /usr/local/include/pqxx/field:19:0,
from /usr/local/include/pqxx/result.hxx:34,
from /usr/local/include/pqxx/result:19,
from /usr/local/include/pqxx/binarystring.hxx:26,
from /usr/local/include/pqxx/binarystring:18,
from /usr/local/include/pqxx/pqxx:17,
from KapStart2.cpp:2:
/usr/local/include/pqxx/field.hxx:43:22: note: ‘pqxx::field’
class PQXX_LIBEXPORT field
^
Da ich ein Anfänger und nicht ein studierter Informatiker bin finde ich den verdammten Fehler nicht.
Ein auf dem ( Feuerwehr- ) Schlauch stehender
Mungo1981
P.S.: So wie ich die Fehlermeldung verstehe, reicht das #include <libpqxx/libpaxx> nicht aus, da ich die folgenden Kapitel erst verstehe wenn ich dieses Kapitel verstanden hab - steh ich halt auf nem Feuerwehrschlauch - und weis nicht so recht was ich tun soll.