QtDesigner project will not compile on Windows



  • I have a project build 90% with QtDesigner but includes SQLite database support.

    My problem is that it compiles and runs perfectly on Linux Mint 16 but not on Windows XP. Both have Qt 5.2.0 from the online install package in the downloads section.

    On the windows compile I get the following error:
    @
    13:57:00: Running steps for project qnetlog...
    13:57:00: Configuration unchanged, skipping qmake step.
    13:57:00: Starting: "C:\Qt\Tools\mingw48_32\bin\mingw32-make.exe"
    C:/Qt/Tools/mingw48_32/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory 'C:/Projects/C++/qnetlog'
    g++ -c -pipe -fno-keep-inline-dllexport -g -fexceptions -mthreads -frtti -Wall -Wextra -DUNICODE -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I"......\Qt\5.2.0\mingw48_32\include" -I"......\Qt\5.2.0\mingw48_32\include\QtSvg" -I"......\Qt\5.2.0\mingw48_32\include\QtWidgets" -I"......\Qt\5.2.0\mingw48_32\include\QtSql" -I"......\Qt\5.2.0\mingw48_32\include\QtGui" -I"......\Qt\5.2.0\mingw48_32\include\QtCore" -I"moc" -I"." -I"......\Qt\5.2.0\mingw48_32\mkspecs\win32-g++" -o obj\main.o main.cpp
    In file included from ......\Qt\5.2.0\mingw48_32\include\QtSql/QtSql:5:0,
    from logfile.hpp:5,
    from mainwindow.hpp:22,
    from main.cpp:3:
    ......\Qt\5.2.0\mingw48_32\include\QtSql/qsqldatabase.h:58:13: error: 'QSqlDriver' does not name a type
    virtual QSqlDriver createObject() const = 0;
    ^
    ......\Qt\5.2.0\mingw48_32\include\QtSql/qsqldatabase.h:65:5: error: 'QSqlDriver' does not name a type
    QSqlDriver createObject() const { return new T; }
    ^
    ......\Qt\5.2.0\mingw48_32\include\QtSql/qsqldatabase.h:83:5: error: 'QSqlIndex' does not name a type
    QSqlIndex primaryIndex(const QString& tablename) const;
    ^
    ......\Qt\5.2.0\mingw48_32\include\QtSql/qsqldatabase.h:86:5: error: 'QSqlError' does not name a type
    QSqlError lastError() const;
    ^
    ......\Qt\5.2.0\mingw48_32\include\QtSql/qsqldatabase.h:110:5: error: 'QSqlDriver' does not name a type
    QSqlDriver
    driver() const;
    ^
    ......\Qt\5.2.0\mingw48_32\include\QtSql/qsqldatabase.h:116:37: error: 'QSqlDriver' has not been declared
    static QSqlDatabase addDatabase(QSqlDriver
    driver,
    ^
    ......\Qt\5.2.0\mingw48_32\include\QtSql/qsqldatabase.h:130:37: error: expected ')' before '' token
    explicit QSqlDatabase(QSqlDriver
    driver);
    ^
    Makefile.Debug:1925: recipe for target 'obj/main.o' failed
    mingw32-make[1]: *** [obj/main.o] Error 1
    mingw32-make[1]: Leaving directory 'C:/Projects/C++/qnetlog'
    makefile:34: recipe for target 'debug' failed
    mingw32-make: *** [debug] Error 2
    13:57:04: The process "C:\Qt\Tools\mingw48_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project qnetlog (kit: Desktop Qt 5.2.0 MinGW 32bit)
    When executing step 'Make'
    13:57:04: Elapsed time: 00:04.
    @

    All the Qt tools and base are in the path.

    Any Ideas? ? ?



  • Delete all intermediate files and do a clean build on both platforms.

    If the problem persists... What are the top 22 lines of mainwindow.hpp and top 5 lines of logfile.hpp?



  • Sorry for the delay in reply... I have been ill, but on the mend now.

    The compile output shown is after a cleanup of the Windows project. No Makefile, no objects, no mocs, user profile re-created - everything rebuilt from source.

    Here is the top lines from the modules mentioned:

    @
    #ifndef MAINWINDOW_HPP
    #define MAINWINDOW_HPP

    #include <QtCore/QTimer>
    #include <QtCore/QTime>
    #include <QtCore/QDateTime>
    #include <QtCore/QEvent>
    #include <QtCore/QStringListModel>
    #include <QtCore/QItemSelectionModel>
    #include <QtGui/QStandardItemModel>
    #include <QtGui/QCloseEvent>
    #include <QtGui/QResizeEvent>
    #include <QtWidgets/QMainWindow>
    #include <QtWidgets/QDataWidgetMapper>
    #include <QtWidgets/QTableWidgetItem>

    class QSqlDatabase;
    class QSqlQuery;
    class QSqlRecord;
    class QSqlQueryModel;

    #include "logfile.hpp"
    #include "netheader.hpp"
    #include "nets.hpp"
    #include "callsigns.hpp"
    #include "dlgNets.hpp"
    #include "dlgcallsigns.hpp"
    #include "dlglogmaint.hpp"

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT
    @

    here is mainwindow.cpp:
    @
    #include <QtCore/QDebug>
    #include <QtCore/QSettings>
    #include <QtCore/QList>
    #include <QtWidgets/QColorDialog>
    #include <QtWidgets/QFontDialog>
    #include <QtSql/QSqlDatabase>
    #include <QtSql/QSqlQuery>
    #include <QtSql/QSqlRecord>
    #include <QtSql/QSqlQueryModel>

    #include "mainwindow.hpp"
    #include "ui_mainwindow.h"

    MainWindow::MainWindow() : QMainWindow(), ui(new Ui::MainWindow)
    @

    and from logfile.hpp:

    @
    #ifndef LOGFILE_HPP
    #define LOGFILE_HPP
    #include <QtCore/QObject>
    #include <QtWidgets/QWidget>
    #include <QtSql/QSqlDatabase>
    #include <QtSql/QSqlError>
    #include <QtSql/QSqlQuery>
    #include <QtSql/QSqlTableModel>

    #include "globals.hpp"

    class LogFile : public QObject
    @

    I even tried to use <QtSql> instead with not change in result.



  • I am assuming your pro file includes
    @QT += sql@
    Or equivalent

    @#include <QSqlDriver>@
    In logfile.hpp

    You really don't need the module names in your #includes



  • Yes. Of course. It would not compile correctly on Linux if not.

    The module names are not required but it does help me to keep my mind straight as to which module is being used.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.