Results 1 to 8 of 8

Thread: Qt in VS does not create an .exe

  1. #1
    Join Date
    Mar 2011
    Posts
    33
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Qt in VS does not create an .exe

    Hello,

    I'm trying to compile a Qt file in VS 10 Ultimate, it compiles without any warning, but it does not create a .exe ( at least I could not find it in the files) and when I press f5 (start) it gives me this error:

    Unable to start program .....

    this application has failed etcetcetc
    Google knows nothing for Qt

    Thanks,

    EDIT: / could be handy
    things I installed:
    VS 10
    Qt Libraries for VS 2008
    Qt plugin for VS

    Do I need the SDK?
    Last edited by Nazgul; 23rd March 2011 at 21:28.

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt in VS does not create an .exe

    Most likely it create an .exe that crashes at run-time.

    Note that different versions of Visual Studio are not binary compatible, so the application built with Visual Studio 2010 will need the Qt dll's to be built with the same version (VS 2010) those Qt libraries you download (Qt Libraries for VS 2008) are not going to work, you will need to build Qt with Visual Studio 2010.

    Some information of how to do that can be found: in this wiki, in official installation guide and here are the steps i used to successfully build Qt with VS 2010 (note that i didn't use any parameters for configure... the default is enough for me, you can look in the other two links information about those parameters)
    //i recommend you download the source code (can be found here) if you try to rebuild the Qt Libraries for VS 2008 you might get errors because of the old built files (you can clean the built by running nmake distclean but i don't know if this saves you from all the issues, it is still a better idea to get the sources)

  3. #3
    Join Date
    Mar 2011
    Posts
    33
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt in VS does not create an .exe

    I download your opensource and the Windows SDK from QtSite and it still does not work. Do I've anything else to do?

    Your source can't even get loaded in VS because there is no qmake

  4. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt in VS does not create an .exe

    The source needs to be built using the Visual Studio 2010, basically you need to extract the sources, navigate with the VS cmd in that folder and:
    1) configure //see parameters in links before
    2) nmake //you can use nmake sub-src (this builds the framework) and nmake sub-tools (builds the tools <designer,etc...>)
    //nmake will take some time (~3 hours on my system)
    3) you can use nmake clean //this will clean the temporary files used during the build - the folder is about 1.5 GB and was 4.5 GB before nmake clean
    4) install the Add-in set the path to folder where you built Qt

    //There are no Qt framework binaries for VS 2010 download, so if you have to use VS 2010 you will need to build the framework yourself.

  5. The following user says thank you to Zlatomir for this useful post:

    Nazgul (25th March 2011)

  6. #5
    Join Date
    Mar 2011
    Posts
    33
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt in VS does not create an .exe

    Thanks,

    I used

    -configure // took not long
    -nmake // about 7 hours , huh it gaves lots of warnings (actually 4) all the time

    Now it works, but when I just click at my .exe it ask for Quid4.dll etc, how can I link them statically?

    And how can instead of making an .exe a .dll . VS project settings .exe ->.dll gave me some errors.

  7. #6
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Qt in VS does not create an .exe

    The warnings usually are in webkit module.

    And on Windows you can copy the required dll's files in the same folder with your .exe file.
    So copy the dll's form PATH_YOU_BUILT_QT\bin folder (example: C:\qt-4.7.2\bin ) in the folder where your application is.

    Note that QtGuid4.dll and QtCored4.dll are the debug builds (and are bigger) those you don't usually need to deploy (the debug build of your application you use when debugging from Visual Studio) and then switch to build the release version of application which will need: QtGui4.dll and QtCore4.dll (and any other dll's for Qt modules you use in your application)

    LE: you have built only the "dynamical" version of Qt (you need a parameter to configure and a rebuild for static) and note that there are some LGPL restrictions about static linkage of Qt in your application

    Also when you deploy to another machine your application will also need the vcredist corresponding to your VS version (2010 in your case).
    Last edited by Zlatomir; 25th March 2011 at 09:02.

  8. #7
    Join Date
    Mar 2011
    Posts
    33
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt in VS does not create an .exe

    now I get this error:

    Qt Code:
    1. moc_qttest.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QMainWindow::staticMetaObject" (?staticMetaObject@QMainWindow@@2UQMetaObject@@B)
    To copy to clipboard, switch view to plain text mode 

    I linked the .libs etc, but still.

  9. #8
    Join Date
    Aug 2012
    Posts
    3
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Cool Re: Qt in VS does not create an .exe

    new to Qt but i am so curious to know something about it
    i have started my basics of Qt, in one my book,
    my question is :

    how do i write a program that ask user to enter a number, and then checks weather the number is prime or not.it should use a QInputDialog to get number from the user and QMessage to display the result.

    i have created my projects, below is my main.cpp:

    #include<QApplication>
    #include<QMessageBox>
    #include<QInputDialog>

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



    return 0;
    }


    and below is .pro


    SOURCES += \
    Question1.cpp



    thank you

Similar Threads

  1. How to Create lib in Qt.
    By shyam prasad in forum Qt Programming
    Replies: 6
    Last Post: 14th August 2012, 10:02
  2. Replies: 4
    Last Post: 1st May 2009, 11:00
  3. How to create a SDK?
    By blackfox in forum Qt Programming
    Replies: 0
    Last Post: 10th September 2008, 10:23
  4. Create tab?
    By songthanjp in forum Qt Tools
    Replies: 4
    Last Post: 12th March 2008, 16:11
  5. how to create pop-ups
    By miguel_mark in forum Newbie
    Replies: 1
    Last Post: 22nd October 2007, 06:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.