Qt 4 + CMake + Visual Studio rules now

Thanks to Bill from Kitware Inc., who responded my previous post in a very timely manner and helped me solve the compilation issues as well as the execution error.  CMake and Visual Studio 2008 are now back in the triangle.

The compilation problem lies the source code of the Qt demo. Two other classes were declared in two of the class definition .cpp files so that either moc’ing the sources or moc’ing the headers will leave some of Q_OBJECT classes un-moc’ed, which causes the linking errors. On the other hand, qmake handles this implicitly so the project file it generates doesn’t have this problem. After moving those declarations to the header files, everything compiled nicely and quietly.

As for the debug execution problem, Bill also suggested that the commercial evaluation version of Qt 4 binary I downloaded might be built with VS 2005. If that is the case, there is no way I can execute in debug mode the program linked against the Qt 4 libraries. I was just being so naive to make the assumption that the binaries should be of no difference if QMAKESPEC is the same.

After downloading and compiling the source of Qt 4.4 beta (boy, that compilation DID take QUITE a while), everything went back to normal. I am now happily “CMaking” my projects again.

1 Response to “Qt 4 + CMake + Visual Studio rules now”


  1. 1 Apolo May 8, 2008 at 1:48 pm

    Hi,
    I would appreciate very much if you give me a hand with QT and VS2005… I can’t create even the simplest “Hello World” application. I’m not an experienced programmer and probably I’m doing some very basic error. I would appreciate very much if you give me a hand with a simple way of implementing at least the hello world app. I have downloaded the qt-win-opensource-4.4.0-mingw.exe file and executed, it was possible to see the demos and everything in the precompiled samples (there are several DLLs in the bin folder of QT4.4.0, maybe I should use this in some way directly).
    When doing the “configure” step I think there was no problem, but when doing the “make” step it goes out with a couple of errors:

    collect2: ld returned 1 exit status
    mingw32-make[2]: *** [..\..\..\bin\rcc.exe] Error 1
    mingw32-make[2]: Leaving directory `C:/yarpStuff/QT440/src/tools/rcc’
    mingw32-make[1]: *** [release] Error 2
    mingw32-make[1]: Leaving directory `C:/yarpStuff/QT440/src/tools/rcc’
    mingw32-make: *** [sub-rcc-make_default-ordered] Error 2

    Thanks in advance for your help.
    Apolo


Leave a Reply