Bash`mysql_config --cflags --libs`
C++ (Qt) QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); db.setHostName("bigblue"); db.setDatabaseName("flightdb"); db.setUserName("acarlson"); db.setPassword("1uTbSbAs"); bool ok = db.open();
C++ (Qt)#include <QtSql> int main() { // QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); db.setHostName("localhost"); db.setDatabaseName("testdb"); db.setUserName("root"); db.setPassword("fortero"); bool ok = db.open(); return 0; }
C++ (Qt)Обновить проект (qmake q3.pro)...Сборка (make)...src/main.cpp:1:17: error: QtSql: No such file or directorysrc/main.cpp:15:2: warning: no newline at end of filesrc/main.cpp: In function 'int main()':src/main.cpp:6: error: 'QSqlDatabase' was not declared in this scopesrc/main.cpp:6: error: expected `;' before 'db'src/main.cpp:7: error: 'db' was not declared in this scopesrc/main.cpp:11: warning: unused variable 'ok'gmake: *** [build/main.o] Ошибка 1g++ -c -pipe -g -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I. -I/usr/local/include/qt4/QtCore -I/usr/local/include/qt4/QtGui -I/usr/local/include/qt4 -Ibuild -I/usr/local/include -o build/main.o src/main.cpp---------------------- Сборка завершена с 4 ошибками и 2 предупреждениями ----------------------