[Solved] Qt 5.1.0 for Windows 32-bit (VS 2010, 505 MB) doesn't work



  • I have downloaded four Qt 5.1.0 packages:
    Qt 5.1.0 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB)
    Qt 5.1.0 for Windows 32-bit (VS 2010, 505 MB)
    Qt 5.1.0 for Windows 64-bit (VS 2012, 525 MB)
    Qt 5.1.0 for Windows 64-bit (VS 2012, OpenGL, 522 MB)

    After installed all these four packages, I created a very simple
    QT project by using Qt 5.1.0 for Windows 32-bit (VS 2010, 505 MB)

    The project is a Qt gui application with a ui form. I created it just follow the
    Qt Creator's template without typing any word. After that I built this project
    and run, everything is OK.

    Then I added a new C++ class to the project. The added C++ class's base class is QWidget.
    This time, I still did not type any word in the .cpp and .h file. So the added class
    only was created by Qt Creator. After that I built this project again, and run,
    everything is still OK.

    Now I began to add my code.
    I added one line in the mainwindow.h:
    #include "myclass.h"

    Then I added another line in the mainwindow.cpp:
    pMyClass = new CMyClass(this);

    After that I built this project again, this time two errors happened.

    error LNK2001: unresolved external symbol public: __thiscall CMyClass::CMyClass(class QWidget *)" (??

    0CMyClass@@QAE@PAVQWidget@@@Z)

    error LNK1120: 1 unresolved externals

    I built the same project by using another three Qt versions:
    Qt 5.1.0 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB)
    Qt 5.1.0 for Windows 64-bit (VS 2012, 525 MB)
    Qt 5.1.0 for Windows 64-bit (VS 2012, OpenGL, 522 MB)

    Build and run were all successful. Everything is OK.

    Because my project can be built and run successfully by using
    Qt 5.1.0 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB)
    Qt 5.1.0 for Windows 64-bit (VS 2012, 525 MB)
    Qt 5.1.0 for Windows 64-bit (VS 2012, OpenGL, 522 MB)

    I am pretty sure there is nothing wrong in my project.

    Only using Qt 5.1.0 for Windows 32-bit (VS 2010, 505 MB) errors happen.

    I was confused by the results. I checked the build directories,
    and I found VS 2010 did not compile mycalss.cpp!
    All other three build directories have the .obj files or .o files of myclass.
    So when link, errors happened.

    My System is Windows7 64bit Ultimate.
    Does anyone know how to solve this problem?

    Thanks.



  • With some nice advice, I sloved it myself.
    First run qmake, then build.



  • @mrplplplplpl: despite not a huge discussion, I find your post quite informative. Can you put "[Solved]" to the title of this thread, to let everybody know that there is a solution.



  • OK, willi, thanks you reminding.


Log in to reply
 

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