Results 1 to 13 of 13

Thread: Qt 4 Windows Installation Tutorial

  1. #1
    Join Date
    Jul 2007
    Posts
    30
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Lightbulb Qt 4 Windows Installation Tutorial

    Well I wasn't sure where to post this, but to help some of those guys that struggle out there, I made a small tutorial about the different methods of using and installing Qt.

    Installing Qt 4.3.3 Windows

    If you don't like it, please tell me why, and tell me how I can improve it to suite your needs or if I'm missing information please tell me.

    If someone wants to elaborate more on the MSVC method please tell me .

    Thanks for your time.
    Last edited by Arsenic; 19th December 2007 at 05:45.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 4 Windows Installation Tutorial

    You will need to buy the commercial version of Qt, or find a place to download the MSVC project for it, usually denoted by .vcproj or .sln. After that it is not difficult to set up.
    This is no longer true.

    I don't like the idea of changing QMAKE_LFLAGS for static linking. If you compile statically it should no longer be needed, Qt/QMake should take care of it by itself.

    I would also reconsider using the %QTDIR% variable. If someone has Qt3 installed, it already has QTDIR defined and pointing to the Qt3 installation dir.

  3. #3
    Join Date
    Jul 2007
    Posts
    30
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4 Windows Installation Tutorial

    Hmm that might explain why I am getting a crash in app.exec() lately.

  4. #4
    Join Date
    Jul 2007
    Posts
    30
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4 Windows Installation Tutorial

    wysota, when I compile without doing the "configure -static -release -no-exception" and "mingw32-make sub-src" it gives me like a
    "ld has returned 1" or something, and makes compiler errors.
    If I do do it, it seems my program runs but disappears as soon as it hits app.exec() or crashes.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 4 Windows Installation Tutorial

    You have to run configure before compilation. But you shouldn't change the specs manually. It's probably not exec that crashes but your code which is called from exec.

  6. #6
    Join Date
    Jul 2007
    Posts
    30
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4 Windows Installation Tutorial

    What do you mean i have to configure and build all of Qt each time I compile? That makes no sense?
    I am doing qmake make, and its compiling, but program disappears even though I have a .show() of a mainwindow.

    Now I'm getting an error like:
    Entering
    Nothing to be done for 'first'
    Leaving

    and thats it, no compilation.

    Damn now I cant compile at all, whats going on. All I did was "configure -platform win32-g++" and "mingw32-make" and thats it...

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 4 Windows Installation Tutorial

    Quote Originally Posted by Arsenic View Post
    What do you mean i have to configure and build all of Qt each time I compile? That makes no sense?
    I was referring to "when I compile without doing the ..." part of your post.

    Now I'm getting an error like:
    Entering
    Nothing to be done for 'first'
    Leaving

    and thats it, no compilation.
    Because nothing changed in the code, so nothing gets compiled.

    Damn now I cant compile at all, whats going on. All I did was "configure -platform win32-g++" and "mingw32-make" and thats it...
    Are we talking about compilation of Qt or your application? Because I'm getting lost here...

  8. #8
    Join Date
    Jul 2007
    Posts
    30
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4 Windows Installation Tutorial

    Ok you're right, how silly of me, I didn't realize I didn't change the code.

    Here's the error I get right now (no compiling of Qt, its set at my last config i posted):
    C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\ mingw32\bin\ld.exe: cannot fin
    d -lQtGuid
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [debug\PSN.exe] Error 1
    mingw32-make[1]: Leaving directory `D:/_SoftDev/PSN'
    mingw32-make: *** [debug] Error 2

    My pro file:
    Qt Code:
    1. TEMPLATE = app
    2. TARGET =
    3. CONFIG += static
    4. DEPENDPATH += .
    5. INCLUDEPATH += .
    To copy to clipboard, switch view to plain text mode 
    Last edited by Arsenic; 20th December 2007 at 20:19.

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 4 Windows Installation Tutorial

    You don't have the debug libraries compiled.

    http://www.qtcentre.org/forum/faq.ph..._no_debug_libs

  10. The following user says thank you to wysota for this useful post:

    Arsenic (20th December 2007)

  11. #10
    Join Date
    Jul 2007
    Posts
    30
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4 Windows Installation Tutorial

    how can I build the debug libraries, I thought they were automatically built.
    Using release inside config of my pro file, only caused 20 linker errors dealing with qt_main and cant linking "memset"...

    Gonna try building qmake with "configure -platform win32-g++ -debug"

    Alright perfect, thanks again wysota.
    Last edited by Arsenic; 20th December 2007 at 22:25.

  12. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 4 Windows Installation Tutorial

    Quote Originally Posted by Arsenic View Post
    how can I build the debug libraries, I thought they were automatically built.
    Follow the link in the FAQ I gave you or take a look at other entries there.

    Using release inside config of my pro file, only caused 20 linker errors dealing with qt_main and cant linking "memset"...
    Sorry

  13. #12
    Join Date
    Jul 2007
    Posts
    30
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 4 Windows Installation Tutorial

    Hey wysota, there seems to be a problem.
    Here's what I noticed, after I simply made a fresh install of Qt 4.3.3, and made sure it works fine, I added the CONFIG += static
    into my pro file.

    However, it is still not compiling the QtGui4.dll, QtCore4.dll and mingw10.dll into my program, because my program is still 19 KB.

  14. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 4 Windows Installation Tutorial

    You need to compile Qt in static mode first. Then you can link your app against the previously compiled static Qt libraries. If you want mingw runtime compiled into the application, you need its static version too (if there is one) and have it before compiling Qt so that it links against the static and not the dynamic archive. You can't static link with dynamic libraries - these are completely different concepts. If you want to be able to do both static and dynamic linkage (for different programs), you need to have both the static and dynamic sets of Qt libraries installed.

Similar Threads

  1. Windows not appearing in XP.
    By beardybloke in forum Qt Programming
    Replies: 7
    Last Post: 24th October 2007, 17:32
  2. converting unix exe to windows binary
    By deekayt in forum General Programming
    Replies: 2
    Last Post: 17th September 2006, 01:00
  3. Qt and windows vista
    By munna in forum General Discussion
    Replies: 8
    Last Post: 11th January 2006, 22:33

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.