Qt World Summit: Register Today!

(SOLVED) Problem with fresh QT installation in Windows 7 (can't create main.o)

  • Hello.
    I spent some time trying to find solution to my problem, but in vain.

    I am trying to install and use QT framework on my Windows 7 Professional edition 32 bits machine. I downloaded whole pack (800+ mb) of QT and run installer. AFter that I added to my system PATH two lines: J:\Qt\Qt5.0.1\5.0.1\mingw47_32\bin; J:\Qt\Qt5.0.1\Tools\MinGW\bin

    After that I created empty project in QT with simple program, that QT created for me by itself. Applications -> QT gui application, "Use as default project location", Next, Next, Next. And here is the code, that was created:

    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>

    namespace Ui {
    class MainWindow;

    class MainWindow : public QMainWindow

    explicit MainWindow(QWidget *parent = 0);

    Ui::MainWindow *ui;

    #endif // MAINWINDOW_H

    @#include "mainwindow.h"
    #include "ui_mainwindow.h"

    MainWindow::MainWindow(QWidget *parent) :
    ui(new Ui::MainWindow)

    delete ui;


    @#include "mainwindow.h"
    #include <QApplication>

    int main(int argc, char *argv[])
    QApplication a(argc, argv);
    MainWindow w;

    return a.exec&#40;&#41;;


    After that I hit Run button on beneath get following error:

    @19:23:09: Running steps for project qldt...
    19:23:09: Configuration unchanged, skipping qmake step.
    19:23:09: Starting: "J:\Qt\Qt5.0.1\Tools\MinGW\bin\mingw32-make.exe"
    J:/Qt/Qt5.0.1/Tools/MinGW/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory 'J:/Users/shidant2/Desktop/workspace/qldt/qldt-build-Desktop_Qt_5_0_1_MinGW_32bit-Debug'
    g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -DQT_NEEDS_QMAIN -I..\qldt -I"............\Qt\Qt5.0.1\5.0.1\mingw47_32\include" -I"............\Qt\Qt5.0.1\5.0.1\mingw47_32\include\QtWidgets" -I"............\Qt\Qt5.0.1\5.0.1\mingw47_32\include\QtGui" -I"............\Qt\Qt5.0.1\5.0.1\mingw47_32\include\QtCore" -I"debug" -I"." -I"." -I"............\Qt\Qt5.0.1\5.0.1\mingw47_32\mkspecs\win32-g++" -o debug\main.o ..\qldt\main.cpp
    Makefile.Debug:357: recipe for target 'debug/main.o' failed
    mingw32-make[1]: *** [debug/main.o] Error 1
    mingw32-make[1]: Leaving directory 'J:/Users/shidant2/Desktop/workspace/qldt/qldt-build-Desktop_Qt_5_0_1_MinGW_32bit-Debug'
    makefile:34: recipe for target 'debug' failed
    mingw32-make: *** [debug] Error 2
    19:23:30: The process "J:\Qt\Qt5.0.1\Tools\MinGW\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project qldt (kit: Desktop Qt 5.0.1 MinGW 32bit)
    When executing step 'Make'@

    As I understand, there no problem with the code, but with compiler. I tried to look for solution, but did not find anything useful.. I guess such serious framework as QT has not to live with such problem, espicially when it impacts the beginner experience. So, please, lets solve it here and now )

    I found something interesting.

    I tried to build everyhing withuot QT:

    I go to cmd and go there to folder: cd J:/Users/shidant2/Desktop/workspace/qldt/qldt-build-Desktop_Qt_5_0_1_MinGW_32bit-Debug

    There I run this:

    @g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -DQT_NEEDS_QMAIN -I..\qldt -I"............\Qt\Qt5.0.1\5.0.1\mingw47_32\include" -I"............\Qt\Qt5.0.1\5.0.1\mingw47_32\include\QtWidgets" -I"............\Qt\Qt5.0.1\5.0.1\mingw47_32\include\QtGui" -I"............\Qt\Qt5.0.1\5.0.1\mingw47_32\include\QtCore" -I"debug" -I"." -I"." -I"............\Qt\Qt5.0.1\5.0.1\mingw47_32\mkspecs\win32-g++" -o debug\main.o ..\qldt\main.cpp
    Then I get my main.o created on disk!

    And if I try to build main.o from QT Creator, it can not build this main.o. Creator creates empty main.o( in this very moment I just can see it in the folder there on disk), hangs some time without doing single thing and after that it gives error (and no file main.o) as I posted in first message.

    I suspect this can be something with permissions for QT in Windows 7. I switched between andministrator and user accounts, but it gave nothing. Still can not figure out what is the problem.

    Any suggestions, guys?

    Thank you.

  • Hi there,
    As always it's hard to give a solid all solving solution to your problem. Don't think you should give QtCreator all the blame so fast btw. Usually problems like this are generated when the qmake wasn't executed prior build command. It seems that the compiler is not able to read your makefile properly. The makefile is generated by qmake.
    Do a clean-all -> run qmake and a build. Might give some insight.
    What usually is better is to completly remove the debug created folder and rerun qmake and the rest.

  • Thank you for the answer. I did as you say, but still have smae error.
    Problem is that running command g++ ... ..\qldt\main.cpp from QT can not produce the object file main.o.
    When I run same command from cmd, it works and it creates main.o

    This problem is not only mine. I read about it many topics and no solution there yet.

  • Problem is solved in new release 5.0.2!

    Thank you!

Log in to reply