Install Qt 5.0 and Qt Creator on Ubuntu



  • Hi everyone.
    I've just installed Qt 5.0 on my computer. Qt Creator has been installed with and a shortcut appears, but does not works ans when I launch it manually I get the error message :
    @cedric@cedric-laptop:~$ cd /opt/Qt5.0.0/Tools/QtCreator/bin/
    cedric@cedric-laptop:/opt/Qt5.0.0/Tools/QtCreator/bin$ ./qtcreator
    Failed to load platform plugin "xcb". Available platforms are:
    linuxfb
    minimal
    xcb

    Abandon
    @

    What should I do ?
    Thanks.



  • I haven't tried on Ubuntu and my Ubuntu system is off right now but have you tried:

    apt-cache search xcb

    and installed what it finds?


  • Moderators

    You need to install dependencies mentioned here: "link":http://qt-project.org/wiki/Building_Qt_5_from_Git. You don't need python and perl, the rest is required.



  • With sierdzio's link, I installed Libxcb and now it works.
    @sudo apt-get install "^libxcb.*" libx11-xcb-dev libglu1-mesa-dev libxrender-dev@

    But I can not create a new project : at the Kit selection, there is "No valid kits found". In the options "Qt version" there is nothing, and in "kits" there is only "manual, desktop (default)".

    I have the quite same error on my computer with Windows 7 : I can create a project, but can not build it by the same reasons.


  • Moderators

    Maybe you have missed installation of a compiler, too? If you are using precompiled packages, you'll need g++ on Linux (clang might also work), and MSVC2010 on Windows (available from MS SDK 7 or MS VisualStudio 2k10).

    Then you'll just need to check your kits (to see if QtC has picked up recent changes).



  • I already cpp programs with both computers (under eclipse IDE with gcc for ubuntu, and code::blocks with mingw for windows). You mean I should install more compilers ?


  • Moderators

    (Windows) If you have not compiled yourself, then you need to install MSVC 2010. MinGW and MSVC are not compatible.

    (Linux) You should be ready to go.

    For kits to work, you need to have valid compiler listed in compilers section, and a Qt added in Qt Versions. Then you can build a kit: just specify a name, compiler to be used, and Qt version you want.



  • All right. In ubuntu I did not specified the Qt version in kits, that is why it does not worked but now it's okay (except some problems in my code, but I think it is because I follow an old tutorial).
    In fact, I get error with this code ... :
    @#include <QtWidgets/QApplication>

    int main(int argc, char* argv[])
    {
    QApplication app(argc, argv);

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

    }@

    I get errors on the QApplication. It seems I do not give the good arguments.


  • Moderators

    Code is fine, if a bit short ;)

    You've probably missed QT += gui widgets in your .pro file. A lot of people seem to be missing that point lately.



  • All right, everything works perfectly. Thanks you a lot. But it's the first time I see I should add QT += gui widgets in the .pro file. I should not forget it next time.


  • Moderators

    There were changes in modules in Qt5. QtGui was split into QtGui (a common base for QtQuick and QtWidgets) and QtWidgets.

    So if you are using widgets, you need to include both QtGui and QtWidgets in your .pro file. If you are using QML, you need QtGui, QtQml and QtQuick.


Log in to reply
 

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