How can I set up my environment for building Qt/Qt applications with MinGW?

In order to build Qt with MinGW, then follow these steps:

1) Download MinGW from our ftp site. There is a link to it in the compiler notes here [doc.qt.nokia.com]

The patched version is a version with more support for DirectShow. That is required if you want to build the phonon DirectShow backend, if you don’t need to build that we require mingw-gcc 4.4 or up as a compiler.

2) Download the qt-everywhere-someVersion.zip package

3) Open a command prompt by typing

  1.  cmd
in Run/Search in the Start Menu

4) Set up the environment as follows in this command prompt:

set PATH=yourPathToMinGW\bin;PATH set INCLUDE= set LIB= set QMAKESPEC=win32-g++

and then type

  1. configure -anyOptionsYouWant && mingw32-make

in this command prompt

5) When building Qt applications, add yourQtVersion\bin to the PATH environment variable like:

  1.   set PATH=yourQtVersion\bin;%PATH%

1 comment

September 7, 2011

Picture of ottoshmidt1 ottoshmidt1

Lab Rat

I followed these instructions to compile qtbase from here – git://gitorious.org/qt/qtbase.git with mingw that comes with qtcreator 2.3 but i get these errors

  1. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:511: error: expected unqualifi
  2. ed-id before numeric constant
  3. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:514: error: expected unqualifi
  4. ed-id before numeric constant
  5. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:515: error: expected unqualifi
  6. ed-id before numeric constant
  7. In file included from ..\..\include\QtCore/qtimer.h:1,
  8.                  from kernel\qt_gui_pch.h:80:
  9. ..\..\include\QtCore/../../src/corelib/kernel/qtimer.h:100: error: expected '}'
  10. at end of input
  11. In file included from ..\..\include\QtGui/qevent.h:1,
  12.                  from kernel\qt_gui_pch.h:74:
  13. ..\..\include\QtGui/../../src/gui/kernel/qevent.h: In member function 'const QPo
  14. int& QDropEvent::pos() const':
  15. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:489: error: 'p' was not declar
  16. ed in this scope
  17. ..\..\include\QtGui/../../src/gui/kernel/qevent.h: In member function 'Qt::Mouse
  18. Buttons QDropEvent::mouseButtons() const':
  19. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:490: error: 'mouseState' was n
  20. ot declared in this scope
  21. ..\..\include\QtGui/../../src/gui/kernel/qevent.h: In member function 'Qt::Keybo
  22. ardModifiers QDropEvent::keyboardModifiers() const':
  23. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:491: error: 'modState' was not
  24.  declared in this scope
  25. ..\..\include\QtGui/../../src/gui/kernel/qevent.h: In member function 'Qt::DropA
  26. ctions QDropEvent::possibleActions() const':
  27. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:493: error: 'act' was not decl
  28. ared in this scope
  29. ..\..\include\QtGui/../../src/gui/kernel/qevent.h: In member function 'Qt::DropA
  30. ction QDropEvent::proposedAction() const':
  31. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:494: error: 'default_action' w
  32. as not declared in this scope
  33. ..\..\include\QtGui/../../src/gui/kernel/qevent.h: In member function 'void QDro
  34. pEvent::acceptProposedAction()':
  35. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:495: error: 'drop_action' was
  36. not declared in this scope
  37. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:495: error: 'default_action' w
  38. as not declared in this scope
  39. ..\..\include\QtGui/../../src/gui/kernel/qevent.h: In member function 'Qt::DropA
  40. ction QDropEvent::dropAction() const':
  41. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:497: error: 'drop_action' was
  42. not declared in this scope
  43. ..\..\include\QtGui/../../src/gui/kernel/qevent.h: In member function 'const QMi
  44. meData* QDropEvent::mimeData() const':
  45. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:501: error: 'mdata' was not de
  46. clared in this scope
  47. ..\..\include\QtGui/../../src/gui/kernel/qevent.h: At global scope:
  48. ..\..\include\QtGui/../../src/gui/kernel/qevent.h:509: error: expected unqualifi
  49. ed-id at end of input
  50. mingw32-make[2]: *** [tmp/obj/debug_shared/qt_gui_pch.h.gch/c++] Error 1
  51. mingw32-make[2]: Leaving directory `d:/oto/qtbase/src/gui'
  52. mingw32-make[1]: *** [debug-all] Error 2
  53. mingw32-make[1]: Leaving directory `d:/oto/qtbase/src/gui'
  54. mingw32-make: *** [sub-gui-make_default-ordered] Error 2

a broader output here – http://pastie.org/2495871

Write a comment

Sorry, you must be logged in to post a comment.