No Qt5 app will start after compilation with MSVC2012



  • Hi everyone,

    I've downloaded Qt5 source code, compiled it by MSVC2012 in release mode and installed smoothly. However, I cannot launch any application such as Qt Designer, examples. When I try to run them, nothing happen, no error message, no log file, no background running (they just start and exit immediately). Could any one give me a couple of suggestions? Thank you.



  • Does your own code work?



  • I am new to Qt so I haven't got any project using Qt yet. I try to examine the examples in Qt project to practice but no example would run even when I copy them into the bin directory. The point is there is no error message so I couldn't figure out what's wrong. Maybe I have to try to build the project in debug mode to see what happen.



  • According to http://qt-project.org/wiki/Qt_5.0, MSVC2012 is not listed as a supported platform yet. You might be better off downloading 2010 express and using the precompiled binaries until official support is added in a later Qt release.

    Note: I am pretty sure you can make it work, but it was not officially tested against the final release so if you are a beginner it might not be the simplest option.



  • Qt5 compiles effortlessly with MSVC2012, I can testify to that.

    Now, whether noob-programmer did a successful build or not is an entirely different topic.

    Try something very simple just to test it out, and figure whether it is a problem of the examples or your build, just paste this into a new Qt console application:

    @#include <QTextStream>
    QTextStream cout(stdout);

    int main(){
    cout << qVersion() << endl;
    }@

    If you don't get a neat 5.0.0 as output you have probably botched up the build process or haven't set up the toolchain properly... As Jens pointed out, for a beginner it is much easier and recommended to get precompiled binaries and use those with the MSVC2010 compiler from VS Express



  • I have just done as utcenter suggested and yes, there is a neat "5.0.0" on console screen. Here is the command I used to compile Qt5:

    @configure -opengl desktop -release -shared -opensource -no-incredibuild-xge -platform win32-msvc2012 -prefix C:\Qt5 -no-style-fusion -no-style-windowsxp -no-style-windowsvista -nomake tests
    nmake
    nmake install@

    If the compilation was ok, there may be something wrong with installation so no Qt app or example would run.

    I am using MSVC2012 to work on some projects which I want to integrate with Qt UI. I hate to convert them to older VC projects and do a bunch of configurations again :(

    I will try to compile Qt5 again in debug mode. Maybe there will be some error message appear in debug mode helping me understand the problem.



  • I've just finish building Qt5 again in both release and debug mode. When I tried to run an example (debug), an error message dialog occurred. Here is what the message said:

    Failed to load platform plugin "Windows". Available platform are: (blank, nothing here)

    Do you have any idea of how to fix this?



  • I found the problem. The environment variable QT_QPA_PLATFORM_PLUGIN_PATH has not been set, so plugins cannot be found. I think this topic should be closed. All Qt apps now run perfectly.

    Thank all you guys :)


Log in to reply
 

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