Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Odd error during release compilation

Odd error during release compilation

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pag-r
    wrote on last edited by
    #1

    I have code with couple forms in it. When I try to compile it to static i get error:
    @login.cpp:2:22: error: ui_login.h: No such file or directory
    login.cpp: In constructor 'Login::Login(QWidget*)':
    login.cpp:11: error: invalid use of incomplete type 'struct Ui::Login'
    login.h:8: error: forward declaration of 'struct Ui::Login'
    login.cpp:13: error: invalid use of incomplete type 'struct Ui::Login'
    login.h:8: error: forward declaration of 'struct Ui::Login'
    login.cpp: In destructor 'virtual Login::~Login()':
    login.cpp:19: warning: possible problem detected in invocation of delete operato
    r:
    login.cpp:19: warning: invalid use of incomplete type 'struct Ui::Login'
    login.h:8: warning: forward declaration of 'struct Ui::Login'
    login.cpp:19: note: neither the destructor nor the class-specific operator delet
    e will be called, even if they are declared when the class is defined.
    login.cpp: In member function 'void Login::on_buttonBox_accepted()':
    login.cpp:24: error: invalid use of incomplete type 'struct Ui::Login'
    login.h:8: error: forward declaration of 'struct Ui::Login'
    login.cpp:26: error: invalid use of incomplete type 'struct Ui::Login'
    login.h:8: error: forward declaration of 'struct Ui::Login'@

    mingw32-make does couple first files ok, but with this gives me errors.

    @
    //login.h
    #ifndef LOGIN_H
    #define LOGIN_H

    #include <QDialog>

    namespace Ui {
    class Login;
    }

    class Login : public QDialog
    {
    Q_OBJECT

    public:
    explicit Login(QWidget *parent = 0);
    ~Login();
    int actualLandlord;

    private:
    Ui::Login *ui;

    private slots:
    void on_buttonBox_accepted();
    };

    #endif // LOGIN_H
    @
    @
    //login.cpp
    #include "login.h"
    #include "ui_login.h"
    #include "mainwindow.h"
    #include <QDebug>
    #include <QtSql>
    #include <QMessageBox>
    #include <QCryptographicHash>

    Login::Login(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Login)
    {
    ui->setupUi(this);
    this->setFixedSize(this->size());
    }

    Login::~Login()
    {
    delete ui;
    }

    void Login::on_buttonBox_accepted()
    {
    QString string = ui->lineEditPwd->text();
    QString hash = QCryptographicHash::hash(string.toAscii(),QCryptographicHash::Md5).toHex().constData();
    QSqlQuery query("select id from landlord where login = '" + ui->lineEditLogin->text() +
    "' and password ='" + hash + "'");
    query.exec();
    if(query.first() ) {
    int id = 0;
    id = query.value(0).toInt();
    this->actualLandlord = id;
    }
    else {
    QMessageBox::warning(this, trUtf8("Warning"),"Invalid user or password",QMessageBox::Ok);
    }
    }
    @
    But when i run in qt creator I don't have any errors and application starts normally, and everything inside login.cpp works fine.
    I don't know why qmake won't make proper ui_login.h :/

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Does uic run and generate that header?

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        If not, did you think to include the actual .ui file in your .pro file under the FORMS variable?

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pag-r
          wrote on last edited by
          #4

          No, uic generates everything except ui_login.h. Andre, You have right, I've added ui_login.h but now I have another error
          @
          g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
          oc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o release\landlord.exe object_script.landlord.Release -L"c:\Qt\STATIC\qt\lib" -L"c:\Qt\STATIC\qt\lib" -lmingw32
          -lqtmain -lQtWebKit -lQtSql -ljscore -lshlwapi -lversion -lQtGui -lQtNetwork -l
          gdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lkern
          el32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
          c:/qt/2010.05/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe:
          cannot find -ljscore
          collect2: ld returned 1 exit status
          mingw32-make[1]: *** [release\landlord.exe] Error 1
          mingw32-make[1]: Leaving directory `c:/Qt/STATIC/qt/landlord'
          mingw32-make: *** [release-all] Error 2
          @
          It's mine first attempt to creating release exe file, so Im sure that my lack of knowledge is general problem:), And sorry for that.

          //edit. Everything works fine. Thanks for help.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved