Results 1 to 2 of 2

Thread: g++ on Windows (mingw-w64)

  1. #1
    Join Date
    Apr 2016
    Qt products
    Unix/X11 Windows

    Default g++ on Windows (mingw-w64)

    I'm using Qt5 on Windows 7 Pro 64-bit. I would like to be able to use g++ to compile Qt5 programs so that I can incorporate assembled assembly code object files at the linkage stage. Using the Notepad example from "" - I renamed the project as QtNotepad.

    When I tried to submit my New Thread to you, the system complained that I had included a total of 8 images and/or videos in my message when only 4 are allowed. Since I had actually included no images or videos at all, I suspect that the system was misreading something. Accordingly, I have attached the body of my New Thread in the attached 20160413QtCentre.txt file.
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 687 Times in 677 Posts
    Qt products
    Windows Android

    Default Re: g++ on Windows (mingw-w64)

    Sorry, but your original post is about the craziest thing I have read here lately.

    First, it is pretty difficult to compile and link Qt projects using the command line. The errors you see are because in your command line, you haven't told g++ anything about where to find the Qt #include files main.cpp references. Read the g++ manual (type "man g++" into Google) and you'll see command line options like "-I<path>", which in your case means "-I<path to qt installation>/include" (where <path to qt installation> is where -you- have Qt installed on your PC).

    The problem is, you'll need to type the same line every time you want to compile main.cpp and every other file in your project. g++ won't remember for you what options you gave it the last time you ran it.

    And when it comes to linking your compiled files into an executable, you'll need to tell the linker where to find all of the Qt library files it needs. There are g++ command line options for that, too.

    But do yourself a favor. Qt has a complete system for building and maintaining projects using qmake and ".pro" project files. It also has Qt Creator, which is a complete IDE (interactive development environment) that helps you edit, maintain, and build projects. Instead of beating your head bloody against the command line, learn to use one of these tools.

    Using qmake standalone requires you to learn how to create .pro files and will generate a Makefile for your project that will have all the correct command line options to compile and link projects with g++. All you'll have to do from the command line is type "make" in the directory with your Makefile, and it will create your executable for you.

    If you use Qt Creator, it will maintain the .pro file for you in most cases, and will run qmake and make as needed to build your project. Qt Creator was installed when you installed Qt if you used the defaults; look in the Tools\QtCreator\bin directory under the top-level of your Qt install. It should have put a shortcut on your desktop when you installed Qt.

Similar Threads

  1. Intallation of qt 5.0.1 for Windows 32-bit (MinGW 4.7)
    By rouge in forum Installation and Deployment
    Replies: 15
    Last Post: 26th February 2013, 10:01
  2. QWT install for Windows with MINGW
    By porucznik in forum Qwt
    Replies: 8
    Last Post: 25th July 2011, 15:23
  3. Windows 7 + Qt + mingw 64-bit
    By serge_malo in forum Newbie
    Replies: 0
    Last Post: 30th September 2010, 13:59
  4. QT 4.2.2 Windows Mingw
    By KaptainKarl in forum Installation and Deployment
    Replies: 3
    Last Post: 4th May 2007, 15:57
  5. qt and mingw can not run on windows 98?
    By evewei in forum Installation and Deployment
    Replies: 4
    Last Post: 26th June 2006, 10:22


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.