g++ javlja ovu gresku pri sastavljanju:
Code:
In file included from /usr/include/pqxx/connection_base:22,
from /usr/include/pqxx/basic_connection.hxx:24,
from /usr/include/pqxx/basic_connection:22,
from /usr/include/pqxx/connection.hxx:23,
from /usr/include/pqxx/connection:22,
from /usr/include/pqxx/pqxx:18,
from MainWindow.CPP:82:
/usr/include/pqxx/connection_base.hxx:669: error: expected unqualified-id before ‘)’ token
In file included from /usr/include/pqxx/transaction_base:23,
from /usr/include/pqxx/cursor.hxx:27,
from /usr/include/pqxx/cursor:22,
from /usr/include/pqxx/pqxx:19,
from MainWindow.CPP:82:
/usr/include/pqxx/transaction_base.hxx:308: error: expected identifier before ‘int’
/usr/include/pqxx/transaction_base.hxx:309: error: expected unqualified-id before ‘{’ token
In file included from /usr/include/pqxx/connection_base:22,
from /usr/include/pqxx/basic_connection.hxx:24,
from /usr/include/pqxx/basic_connection:22,
from /usr/include/pqxx/connection.hxx:23,
from /usr/include/pqxx/connection:22,
from /usr/include/pqxx/pqxx:18,
from MainWindow.CPP:82:
/usr/include/pqxx/connection_base.hxx:669: error: expected unqualified-id before ‘)’ token
In file included from /usr/include/pqxx/transaction_base:23,
from /usr/include/pqxx/cursor.hxx:27,
from /usr/include/pqxx/cursor:22,
from /usr/include/pqxx/pqxx:19,
from MainWindow.CPP:82:
/usr/include/pqxx/transaction_base.hxx:308: error: expected identifier before ‘int’
/usr/include/pqxx/transaction_base.hxx:309: error: expected unqualified-id before ‘{’ token
Medjutim deo koda koji sam stavio u moj program se uredno sastavlja kad je izolovan u main():
Code:
#include <iostream>
#include "pqxx/pqxx"
using namespace std;
using namespace pqxx;
int main()
{
try
{
connection C("host=localhost port=5432 dbname=pagilla user=postgres password=postgres");
cout << "Connected to " << C.dbname() << endl;
work W(C);
result R = W.exec("SELECT * FROM actor");
cout << "Nashao " << R.size() << "glumaca:" << endl;
for (result::const_iterator r = R.begin();
r != R.end();
++r)
{
cout << r[0].c_str() <<' '<<r[1].c_str()<<' '<<r[2].c_str()<<' '<<r[3].c_str() << endl;
}
}
catch (const exception &e)
{
cerr << e.what() << endl;
return 1;
}
return 0;
}
#include <iostream>
#include "pqxx/pqxx"
using namespace std;
using namespace pqxx;
int main()
{
try
{
connection C("host=localhost port=5432 dbname=pagilla user=postgres password=postgres");
cout << "Connected to " << C.dbname() << endl;
work W(C);
result R = W.exec("SELECT * FROM actor");
cout << "Nashao " << R.size() << "glumaca:" << endl;
for (result::const_iterator r = R.begin();
r != R.end();
++r)
{
cout << r[0].c_str() <<' '<<r[1].c_str()<<' '<<r[2].c_str()<<' '<<r[3].c_str() << endl;
}
}
catch (const exception &e)
{
cerr << e.what() << endl;
return 1;
}
return 0;
}
Mozda neko zna o cemu se radi? (moj C++ nivo je pocetnicki)
Ag + Na -> Xe