Cannot compile. Please help!



  • Hi! I am new to Qt and I currently revising C++

    I have created this simple program:

    @#include <QCoreApplication>
    #include <QDebug>

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);

    qDebug() << "hello world";
    
    return a.exec&#40;&#41;;
    

    }@

    When I press Run I get the following error messsage: Qt Creator needs a compiler set up to build. Configure a compiler in the kit options.

    So I went to Tools>Options and selected Build&Run and Compilers tab. There is the Microsoft Visual C++ Compiler 12.0 (x86) under the Auto-detected option. I installed MinGW compiler for windows 32-bit and I added it to the Compilers. I selected MinGW as the compiler and pressed Run and i got the same error message. Have i done something wrong in the installation or configuration of the compiler?

    Thanks


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What version of Qt did you installed ?

    If it's a Visual Studio version, you need to match the version e.g. Visual Studio 2010 for the VS2010 package. They can't be mixed accross different version and you can't use MinGW with that version of Qt.

    If you installed the MinGW version, please remove any external version. This package comes with a known working version of MinGW



  • Thanks SGalst.

    I think I have installed the VS2010, OpenGL package. I do have Visual Studio 2013 Premium on my machine though.

    Is MinGW an IDE as Visual Studio?

    If yes then I will remove the MinGW compiler and i will download the VS2012 package and I will uninstall Visual Studio 2013 and i will install Visual Studio 2012 (Premium or Ultimate? from piratebay. Do you know any working Visual Studio 2012 torrent?)


  • Moderators

    No, MinGW is not an IDE.

    As I see you are using Qt creator as an IDE. MinGW is an opensource compiler. It works well with Qt creator, but you have to install the pre-build for MionGW for Qt libs.

    You can use also VS compilers with Qt creator, but you have to pay close attention to the version you are using. The different VS compiler are not compatible between versions.

    You use the online installer for the SDK for MinGW from the download page. It does give you also an opportunity to install directly MinGW compiler.


  • Lifetime Qt Champion

    To add to koahnig, there are currently no pre-built packages for VS2013, you would have to build Qt yourself.

    Microsoft provides the Express edition free of charge for Visual Studio (it has a few restriction though)


  • Moderators

    [quote author="SweetOrange" date="1392659827"]I think I have installed the VS2010, OpenGL package.[/quote]Then you can get your setup to work by installing the VS2010 compiler. You can't download Visual Studio 2010 any more, but the same compiler exists in "Windows SDK 7.1":http://www.microsoft.com/en-au/download/details.aspx?id=8279

    Note that if you get the OpenGL package, your system's graphics drivers must support OpenGL 2.0 or higher.

    [quote]i will install Visual Studio 2012 (Premium or Ultimate? from piratebay. Do you know any working Visual Studio 2012 torrent?)[/quote]We don't condone piracy here.

    The free Express edition provides all the same benefits as the Ultimate edition if you use Qt Creator as your IDE.



  • I have installed Qt creator with MinGW. Now it compiles and run the code.
    This problem solved!


Log in to reply
 

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