I am running Ubuntu 14.04 (Trusty Tahr). I have installed Qt from the package qt-sdk. I have also installed the following package which should have installed the PostgreSQL driver:
libqt5sql5-psql
My Qt version is:
Qt Creator 3.0.1 based on Qt 5.2.1
When I try to create a Qt db object of type postgres like so:
QSqlDatabase db = QSqlDatabase::addDatabase(“QPSQL”);
I get a lot of errors like so:
/home/bc/projects/qt_test/main.cpp:12: error: stray '\342' in program
QSqlDatabase db = QSqlDatabase::addDatabase(“QPSQL”);
^
/home/bc/projects/qt_test/main.cpp:12: error: 'QPSQL' was not declared in this scope
QSqlDatabase db = QSqlDatabase::addDatabase(“QPSQL”);
I am obviously not doing something correctly. I don't know what though. Perhaps I am missing a package, or I have misconfigured something.
How can I fix it?
“", at least as posted here, is Unicode code point U+201C (LEFT DOUBLE QUOTATION MARK). The UTF-8 sequence is 0xE2 0x80 0x9C (hexadecimal), 342 200 234 (octal), so "error: stray '\342' in program. error: stray '\200' in program. error: stray '\234' in program" is expected in the error output (three errors for this one character alone).