Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [Solved]Qt4.8.1 for Desktop (MinGW) Compiler Error (-Wl,-subsystem,windows)
Forum Updated to NodeBB v4.3 + New Features

[Solved]Qt4.8.1 for Desktop (MinGW) Compiler Error (-Wl,-subsystem,windows)

Scheduled Pinned Locked Moved Installation and Deployment
4 Posts 2 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    genetica
    wrote on last edited by
    #1

    Good day

    I have the following program:
    @/* temp.cpp Qt test file */
    #include <iostream>

    int main()
    {
    using namespace std;
    cout << "Hello world";
    return 0;
    }@

    I open Qt4.8.1 for Desktop (MinGW) and ran the following(also showing the output):
    @
    d:\temp>qmake -project

    d:\temp>qmake

    d:\temp>mingw32-make
    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `d:/temp'
    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\QtSDK\Desktop\Qt\4.8.1\mingw\include\QtCore" -I"..\QtSDK\Desktop\Qt\4.8.1\mingw\include\QtGui" -I"..\QtSDK\Desktop\Qt\4.8.1\mingw\include" -I"." -I"..\QtSDK\Desktop\Qt\4.8.1\mingw\include\ActiveQt" -I"debug" -"..\QtSDK\Desktop\Qt\4.8.1\mingw\mkspecs\default" -o debug\temp.o temp.cpp

    g++ -mthreads -Wl,-subsystem,windows -o debug\temp.exe debug/temp.o -L"d:\QtSDK\Desktop\Qt\4.8.1\mingw\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4

    mingw32-make[1]: Leaving directory `d:/temp'

    d:\temp>debug\temp

    d:\temp>g++ -o debug\temp.exe temp.cpp

    d:\temp>debug\temp
    Hello world
    d:\temp>
    @
    So I compiled the same project with qmake Makefile and directly with mingw. As you can see the qmake compilation compiled a file doing nothing where the mingw compiled correctly. Any ideas why or what is going on? The SDK is working correctly so the installed Qt is not broken.

    Any help please?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      genetica
      wrote on last edited by
      #2

      I have found the problem, by removing the flags

      @-Wl,-subsystem,windows@

      I can compile a working exe. What does these flags mean, I cant find them in the documentation? Why are they added to the qmake generated Makefiles?

      1 Reply Last reply
      0
      • ZlatomirZ Offline
        ZlatomirZ Offline
        Zlatomir
        wrote on last edited by
        #3

        -Wl,-subsystem,windows makes an application with GUI and -Wl,-subsystem,console makes a console application - and those were added because you created an Qt GUI application instead a Qt console application //add CONFIG += console to your .pro file (when you create a console application) and then run qmake and it should build just fine.

        https://forum.qt.io/category/41/romanian

        1 Reply Last reply
        0
        • G Offline
          G Offline
          genetica
          wrote on last edited by
          #4

          Great thanks, it works now. Using
          @qmake -project CONFIG+=console@

          Followed with all the rest of the commands.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved