Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. compilation err in qt test program
Forum Updated to NodeBB v4.3 + New Features

compilation err in qt test program

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 1.7k Views
  • 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.
  • R Offline
    R Offline
    ravi2k18
    wrote on last edited by
    #1

    hi All,
    I am beginner to qt and trying to run the below progam. however i am getting below err.

    qobject.h:117:5: error: expected parameter declarator
    main.cpp:1:1: note: in file included from C:\Qt-Workspace\untitled1\main.cpp:1:
    main.cpp:1:10: note: in file included from C:\Qt-Workspace\untitled1\main.cpp:1:
    QApplication:1:10: note: in file included from C:\win-builds\include\qt5\QtWidgets\QApplication:1:
    qapplication.h:45:10: note: in file included from C:\win-builds\include\qt5\QtWidgets/qapplication.h:45:
    qcoreapplication.h:48:10: note: in file included from C:\win-builds\include\qt5\QtCore/qcoreapplication.h:48:
    
    ----------------------------------
    
    15:44:21: Running steps for project untitled1...
    15:44:21: Configuration unchanged, skipping qmake step.
    15:44:21: Starting: "C:\win-builds\bin\mingw32-make.exe" -j4
    C:/win-builds/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory 'C:/Qt-Workspace/build-untitled1-Desktop-Debug'
    x86_64-w64-mingw32-g++ -Wl,-subsystem,windows -mthreads -o debug\name_of_the_app.exe debug/main.o  -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -LC:/win-builds/lib -lqtmaind -lQt5Widgetsd -lQt5Guid -lQt5Cored 
    c:/win-builds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqtmaind
    c:/win-builds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Widgetsd
    c:/win-builds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Guid
    c:/win-builds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Cored
    collect2.exe: error: ld returned 1 exit status
    mingw32-make[1]: *** [debug\name_of_the_app.exe] Error 1
    Makefile.Debug:77: recipe for target 'debug\name_of_the_app.exe' failed
    mingw32-make[1]: Leaving directory 'C:/Qt-Workspace/build-untitled1-Desktop-Debug'
    Makefile:34: recipe for target 'debug' failed
    mingw32-make: *** [debug] Error 2
    15:44:22: The process "C:\win-builds\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project untitled1 (kit: Desktop)
    When executing step "Make"
    15:44:22: Elapsed time: 00:01.
    
    #include <QApplication>
    #include <QPushButton>
    
    int main(int argc, char **argv)
    {
     QApplication app (argc, argv);
    
     QPushButton button ("Hello world !");
     button.show();
    
     return app.exec();
    }
    
    
    TEMPLATE = app
    TARGET = name_of_the_app
    
    QT = core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    SOURCES +=  main.cpp
    
    

    I have copied the above code from https://wiki.qt.io/Qt_for_Beginners#C.2B.2B_reminder
    Is this because the sample code is valid for qt4 and I am running qt 5 ?
    Please help me to fix the issue. so that I can continue my learning.

    thanks in advance.

    jsulmJ 1 Reply Last reply
    0
    • R ravi2k18

      hi All,
      I am beginner to qt and trying to run the below progam. however i am getting below err.

      qobject.h:117:5: error: expected parameter declarator
      main.cpp:1:1: note: in file included from C:\Qt-Workspace\untitled1\main.cpp:1:
      main.cpp:1:10: note: in file included from C:\Qt-Workspace\untitled1\main.cpp:1:
      QApplication:1:10: note: in file included from C:\win-builds\include\qt5\QtWidgets\QApplication:1:
      qapplication.h:45:10: note: in file included from C:\win-builds\include\qt5\QtWidgets/qapplication.h:45:
      qcoreapplication.h:48:10: note: in file included from C:\win-builds\include\qt5\QtCore/qcoreapplication.h:48:
      
      ----------------------------------
      
      15:44:21: Running steps for project untitled1...
      15:44:21: Configuration unchanged, skipping qmake step.
      15:44:21: Starting: "C:\win-builds\bin\mingw32-make.exe" -j4
      C:/win-builds/bin/mingw32-make -f Makefile.Debug
      mingw32-make[1]: Entering directory 'C:/Qt-Workspace/build-untitled1-Desktop-Debug'
      x86_64-w64-mingw32-g++ -Wl,-subsystem,windows -mthreads -o debug\name_of_the_app.exe debug/main.o  -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -LC:/win-builds/lib -lqtmaind -lQt5Widgetsd -lQt5Guid -lQt5Cored 
      c:/win-builds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqtmaind
      c:/win-builds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Widgetsd
      c:/win-builds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Guid
      c:/win-builds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Cored
      collect2.exe: error: ld returned 1 exit status
      mingw32-make[1]: *** [debug\name_of_the_app.exe] Error 1
      Makefile.Debug:77: recipe for target 'debug\name_of_the_app.exe' failed
      mingw32-make[1]: Leaving directory 'C:/Qt-Workspace/build-untitled1-Desktop-Debug'
      Makefile:34: recipe for target 'debug' failed
      mingw32-make: *** [debug] Error 2
      15:44:22: The process "C:\win-builds\bin\mingw32-make.exe" exited with code 2.
      Error while building/deploying project untitled1 (kit: Desktop)
      When executing step "Make"
      15:44:22: Elapsed time: 00:01.
      
      #include <QApplication>
      #include <QPushButton>
      
      int main(int argc, char **argv)
      {
       QApplication app (argc, argv);
      
       QPushButton button ("Hello world !");
       button.show();
      
       return app.exec();
      }
      
      
      TEMPLATE = app
      TARGET = name_of_the_app
      
      QT = core gui
      
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      SOURCES +=  main.cpp
      
      

      I have copied the above code from https://wiki.qt.io/Qt_for_Beginners#C.2B.2B_reminder
      Is this because the sample code is valid for qt4 and I am running qt 5 ?
      Please help me to fix the issue. so that I can continue my learning.

      thanks in advance.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @ravi2k18 This code builds perfectly fine for me with Qt 5.12 MinGW.
      What Qt version do you use?

      "c:/win-builds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqtmaind
      c:/win-builds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Widgetsd
      c:/win-builds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Guid
      c:/win-builds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Cored"

      How did you install Qt? And which EXACT version?
      Why do you use MinGW x86_64 4.8.3? Supported version is 7.3.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • R Offline
        R Offline
        ravi2k18
        wrote on last edited by
        #3

        i used offline installer to install qt5 qt-opensource-windows-x86-5.12.0.exe
        looks like my qt creator is taking some other mingw installation dir. why so ?? when i have installed qt with dedicated mingw for this.

        my QTdir is C:\win-dir while mingw 7 is installed in C:\Qt\Qt5.12.0\Tools\mingw730_64\bin
        do i need specifically set the environment variables?

        thanks

        1 Reply Last reply
        0
        • R Offline
          R Offline
          ravi2k18
          wrote on last edited by
          #4

          i furthur update my build setting to refer mingw 7 but no luck

          18:40:28: Running steps for project test...
          18:40:28: Starting: "C:\win-builds\bin\qmake.exe" C:\Qt-Workspace\test\test.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
          18:40:28: The process "C:\win-builds\bin\qmake.exe" exited normally.
          18:40:28: Starting: "C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" -f C:/Qt-Workspace/Makefile qmake_all
          mingw32-make: Nothing to be done for 'qmake_all'.
          18:40:28: The process "C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" exited normally.
          18:40:28: Starting: "C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" -j4
          C:/Qt/Qt5.12.0/Tools/mingw730_64/bin/mingw32-make -f Makefile.Debug
          mingw32-make[1]: Entering directory 'C:/Qt-Workspace'
          Makefile.Debug:346: warning: overriding recipe for target 'debug/main.o'
          Makefile.Debug:234: warning: ignoring old recipe for target 'debug/main.o'
          x86_64-w64-mingw32-g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -Itest -I"..\win-builds\include\qt5" -I"..\win-builds\include\qt5\QtWidgets" -I"..\win-builds\include\qt5\QtGui" -I"..\win-builds\include\qt5\QtCore" -I"debug" -I"." -I"..\win-builds\mkspecs\win32-g++" -o debug\main.o test\main.cpp
          In file included from ..\win-builds\include\qt5/QtCore/qbytearray.h:45:0,
          from ..\win-builds\include\qt5/QtCore/qstring.h:46,
          from ..\win-builds\include\qt5/QtCore/qcoreapplication.h:46,
          from ..\win-builds\include\qt5\QtWidgets/qapplication.h:45,
          from ..\win-builds\include\qt5\QtWidgets/QApplication:1,
          from test\main.cpp:1:
          ..\win-builds\include\qt5/QtCore/qrefcount.h:58:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
          #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          ..\win-builds\include\qt5/QtCore/qrefcount.h:69:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
          #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          ..\win-builds\include\qt5/QtCore/qrefcount.h:78:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
          #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          In file included from ..\win-builds\include\qt5/QtCore/qbytearray.h:47:0,
          from ..\win-builds\include\qt5/QtCore/qstring.h:46,
          from ..\win-builds\include\qt5/QtCore/qcoreapplication.h:46,
          from ..\win-builds\include\qt5\QtWidgets/qapplication.h:45,
          from ..\win-builds\include\qt5\QtWidgets/QApplication:1,
          from test\main.cpp:1:
          ..\win-builds\include\qt5/QtCore/qarraydata.h:83:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
          #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          ..\win-builds\include\qt5/QtCore/qarraydata.h:104:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
          #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          In file included from ..\win-builds\include\qt5/QtCore/qobject.h:51:0,
          from ..\win-builds\include\qt5/QtCore/qcoreapplication.h:48,
          from ..\win-builds\include\qt5\QtWidgets/qapplication.h:45,
          from ..\win-builds\include\qt5\QtWidgets/QApplication:1,
          from test\main.cpp:1:
          ..\win-builds\include\qt5/QtCore/qlist.h:149:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
          #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          In file included from ..\win-builds\include\qt5/QtCore/qvariant.h:49:0,
          from ..\win-builds\include\qt5/QtCore/qlocale.h:45,
          from ..\win-builds\include\qt5/QtGui/qguiapplication.h:48,
          from ..\win-builds\include\qt5\QtWidgets/qapplication.h:56,
          from ..\win-builds\include\qt5\QtWidgets/QApplication:1,
          from test\main.cpp:1:
          ..\win-builds\include\qt5/QtCore/qmap.h:374:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
          #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          In file included from ..\win-builds\include\qt5/QtCore/qvariant.h:50:0,
          from ..\win-builds\include\qt5/QtCore/qlocale.h:45,
          from ..\win-builds\include\qt5/QtGui/qguiapplication.h:48,
          from ..\win-builds\include\qt5\QtWidgets/qapplication.h:56,
          from ..\win-builds\include\qt5\QtWidgets/QApplication:1,
          from test\main.cpp:1:
          ..\win-builds\include\qt5/QtCore/qhash.h:333:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
          #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          In file included from ..\win-builds\include\qt5/QtGui/qpolygon.h:45:0,
          from ..\win-builds\include\qt5/QtGui/qmatrix.h:45,
          from ..\win-builds\include\qt5/QtGui/qtransform.h:44,
          from ..\win-builds\include\qt5/QtGui/qimage.h:45,
          from ..\win-builds\include\qt5/QtGui/qpixmap.h:50,
          from ..\win-builds\include\qt5/QtGui/qicon.h:48,
          from ..\win-builds\include\qt5/QtWidgets/qabstractbutton.h:45,
          from ..\win-builds\include\qt5\QtWidgets/qpushbutton.h:45,
          from ..\win-builds\include\qt5\QtWidgets/QPushButton:1,
          from test\main.cpp:2:
          ..\win-builds\include\qt5/QtCore/qvector.h:110:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
          #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          In file included from ..\win-builds\include\qt5/QtGui/qpolygon.h:45:0,
          from ..\win-builds\include\qt5/QtGui/qmatrix.h:45,
          from ..\win-builds\include\qt5/QtGui/qtransform.h:44,
          from ..\win-builds\include\qt5/QtGui/qimage.h:45,
          from ..\win-builds\include\qt5/QtGui/qpixmap.h:50,
          from ..\win-builds\include\qt5/QtGui/qicon.h:48,
          from ..\win-builds\include\qt5/QtWidgets/qabstractbutton.h:45,
          from ..\win-builds\include\qt5\QtWidgets/qpushbutton.h:45,
          from ..\win-builds\include\qt5\QtWidgets/QPushButton:1,
          from test\main.cpp:2:
          ..\win-builds\include\qt5/QtCore/qvector.h:334:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
          #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          ..\win-builds\include\qt5/QtCore/qvector.h:491:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
          #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          ..\win-builds\include\qt5/QtCore/qvector.h:559:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
          #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          x86_64-w64-mingw32-g++ -Wl,-subsystem,windows -mthreads -o debug\name_of_the_app.exe debug/main.o debug/main.o -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -LC:/win-builds/lib -lqtmaind -lQt5Widgetsd -lQt5Guid -lQt5Cored
          debug/main.o:C:\Qt-Workspace/test/main.cpp:5: multiple definition of `qMain(int, char**)'
          debug/main.o:C:\Qt-Workspace/test/main.cpp:5: first defined here
          C:/Qt/Qt5.12.0/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqtmaind
          C:/Qt/Qt5.12.0/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Widgetsd
          C:/Qt/Qt5.12.0/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Guid
          C:/Qt/Qt5.12.0/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Cored
          collect2.exe: error: ld returned 1 exit status
          mingw32-make[1]: *** [Makefile.Debug:79: debug\name_of_the_app.exe] Error 1
          mingw32-make: *** [Makefile:34: debug] Error 2
          mingw32-make[1]: Leaving directory 'C:/Qt-Workspace'
          18:40:32: The process "C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" exited with code 2.
          Error while building/deploying project test (kit: Desktop)
          When executing step "Make"
          18:40:32: Elapsed time: 00:04.

          jsulmJ 1 Reply Last reply
          0
          • R ravi2k18

            i furthur update my build setting to refer mingw 7 but no luck

            18:40:28: Running steps for project test...
            18:40:28: Starting: "C:\win-builds\bin\qmake.exe" C:\Qt-Workspace\test\test.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
            18:40:28: The process "C:\win-builds\bin\qmake.exe" exited normally.
            18:40:28: Starting: "C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" -f C:/Qt-Workspace/Makefile qmake_all
            mingw32-make: Nothing to be done for 'qmake_all'.
            18:40:28: The process "C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" exited normally.
            18:40:28: Starting: "C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" -j4
            C:/Qt/Qt5.12.0/Tools/mingw730_64/bin/mingw32-make -f Makefile.Debug
            mingw32-make[1]: Entering directory 'C:/Qt-Workspace'
            Makefile.Debug:346: warning: overriding recipe for target 'debug/main.o'
            Makefile.Debug:234: warning: ignoring old recipe for target 'debug/main.o'
            x86_64-w64-mingw32-g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -Itest -I"..\win-builds\include\qt5" -I"..\win-builds\include\qt5\QtWidgets" -I"..\win-builds\include\qt5\QtGui" -I"..\win-builds\include\qt5\QtCore" -I"debug" -I"." -I"..\win-builds\mkspecs\win32-g++" -o debug\main.o test\main.cpp
            In file included from ..\win-builds\include\qt5/QtCore/qbytearray.h:45:0,
            from ..\win-builds\include\qt5/QtCore/qstring.h:46,
            from ..\win-builds\include\qt5/QtCore/qcoreapplication.h:46,
            from ..\win-builds\include\qt5\QtWidgets/qapplication.h:45,
            from ..\win-builds\include\qt5\QtWidgets/QApplication:1,
            from test\main.cpp:1:
            ..\win-builds\include\qt5/QtCore/qrefcount.h:58:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
            #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            ..\win-builds\include\qt5/QtCore/qrefcount.h:69:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
            #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            ..\win-builds\include\qt5/QtCore/qrefcount.h:78:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
            #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            In file included from ..\win-builds\include\qt5/QtCore/qbytearray.h:47:0,
            from ..\win-builds\include\qt5/QtCore/qstring.h:46,
            from ..\win-builds\include\qt5/QtCore/qcoreapplication.h:46,
            from ..\win-builds\include\qt5\QtWidgets/qapplication.h:45,
            from ..\win-builds\include\qt5\QtWidgets/QApplication:1,
            from test\main.cpp:1:
            ..\win-builds\include\qt5/QtCore/qarraydata.h:83:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
            #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            ..\win-builds\include\qt5/QtCore/qarraydata.h:104:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
            #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            In file included from ..\win-builds\include\qt5/QtCore/qobject.h:51:0,
            from ..\win-builds\include\qt5/QtCore/qcoreapplication.h:48,
            from ..\win-builds\include\qt5\QtWidgets/qapplication.h:45,
            from ..\win-builds\include\qt5\QtWidgets/QApplication:1,
            from test\main.cpp:1:
            ..\win-builds\include\qt5/QtCore/qlist.h:149:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
            #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            In file included from ..\win-builds\include\qt5/QtCore/qvariant.h:49:0,
            from ..\win-builds\include\qt5/QtCore/qlocale.h:45,
            from ..\win-builds\include\qt5/QtGui/qguiapplication.h:48,
            from ..\win-builds\include\qt5\QtWidgets/qapplication.h:56,
            from ..\win-builds\include\qt5\QtWidgets/QApplication:1,
            from test\main.cpp:1:
            ..\win-builds\include\qt5/QtCore/qmap.h:374:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
            #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            In file included from ..\win-builds\include\qt5/QtCore/qvariant.h:50:0,
            from ..\win-builds\include\qt5/QtCore/qlocale.h:45,
            from ..\win-builds\include\qt5/QtGui/qguiapplication.h:48,
            from ..\win-builds\include\qt5\QtWidgets/qapplication.h:56,
            from ..\win-builds\include\qt5\QtWidgets/QApplication:1,
            from test\main.cpp:1:
            ..\win-builds\include\qt5/QtCore/qhash.h:333:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
            #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            In file included from ..\win-builds\include\qt5/QtGui/qpolygon.h:45:0,
            from ..\win-builds\include\qt5/QtGui/qmatrix.h:45,
            from ..\win-builds\include\qt5/QtGui/qtransform.h:44,
            from ..\win-builds\include\qt5/QtGui/qimage.h:45,
            from ..\win-builds\include\qt5/QtGui/qpixmap.h:50,
            from ..\win-builds\include\qt5/QtGui/qicon.h:48,
            from ..\win-builds\include\qt5/QtWidgets/qabstractbutton.h:45,
            from ..\win-builds\include\qt5\QtWidgets/qpushbutton.h:45,
            from ..\win-builds\include\qt5\QtWidgets/QPushButton:1,
            from test\main.cpp:2:
            ..\win-builds\include\qt5/QtCore/qvector.h:110:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
            #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            In file included from ..\win-builds\include\qt5/QtGui/qpolygon.h:45:0,
            from ..\win-builds\include\qt5/QtGui/qmatrix.h:45,
            from ..\win-builds\include\qt5/QtGui/qtransform.h:44,
            from ..\win-builds\include\qt5/QtGui/qimage.h:45,
            from ..\win-builds\include\qt5/QtGui/qpixmap.h:50,
            from ..\win-builds\include\qt5/QtGui/qicon.h:48,
            from ..\win-builds\include\qt5/QtWidgets/qabstractbutton.h:45,
            from ..\win-builds\include\qt5\QtWidgets/qpushbutton.h:45,
            from ..\win-builds\include\qt5\QtWidgets/QPushButton:1,
            from test\main.cpp:2:
            ..\win-builds\include\qt5/QtCore/qvector.h:334:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
            #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            ..\win-builds\include\qt5/QtCore/qvector.h:491:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
            #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            ..\win-builds\include\qt5/QtCore/qvector.h:559:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
            #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            x86_64-w64-mingw32-g++ -Wl,-subsystem,windows -mthreads -o debug\name_of_the_app.exe debug/main.o debug/main.o -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -LC:/win-builds/lib -lqtmaind -lQt5Widgetsd -lQt5Guid -lQt5Cored
            debug/main.o:C:\Qt-Workspace/test/main.cpp:5: multiple definition of `qMain(int, char**)'
            debug/main.o:C:\Qt-Workspace/test/main.cpp:5: first defined here
            C:/Qt/Qt5.12.0/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqtmaind
            C:/Qt/Qt5.12.0/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Widgetsd
            C:/Qt/Qt5.12.0/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Guid
            C:/Qt/Qt5.12.0/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Cored
            collect2.exe: error: ld returned 1 exit status
            mingw32-make[1]: *** [Makefile.Debug:79: debug\name_of_the_app.exe] Error 1
            mingw32-make: *** [Makefile:34: debug] Error 2
            mingw32-make[1]: Leaving directory 'C:/Qt-Workspace'
            18:40:32: The process "C:\Qt\Qt5.12.0\Tools\mingw730_64\bin\mingw32-make.exe" exited with code 2.
            Error while building/deploying project test (kit: Desktop)
            When executing step "Make"
            18:40:32: Elapsed time: 00:04.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by jsulm
            #5

            @ravi2k18 Why don't you just install Qt using online installer (Qt Maintenance Too if you already installed MinGW using online installer)? This is usually working out of the box (Qt + MinGW).
            If you installed Qt in C:\win-dir then why do you call C:\win-builds\bin\qmake.exe ?!
            Also - is your Qt for MinGW 64bit?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • dheerendraD Offline
              dheerendraD Offline
              dheerendra
              Qt Champions 2022
              wrote on last edited by dheerendra
              #6

              Looks like u r using different qmake than what is coming with qt install. According to ur installed qt qmake shud be from c:/Qt\Qt5.12.0\Tools\mingw730_64\bin\qmake
              But I see a different directory. Can you show your build settings ? Do you see directory :\win-builds\lib with all the qt DLLs ? Looks like your mingw is 64 bit. So you have corresponding libraries ? Do you see any red mark for your kit in buld & run configuration ?

              Dheerendra
              @Community Service
              Certified Qt Specialist
              http://www.pthinks.com

              1 Reply Last reply
              1
              • mranger90M Offline
                mranger90M Offline
                mranger90
                wrote on last edited by mranger90
                #7

                @ravi2k18 said in compilation err in qt test program:

                TEMPLATE = app
                TARGET = name_of_the_app

                QT = core gui

                Try Qt += core gui

                Note the "+="
                Also remember to re-run qmake after changing the .pro file.

                1 Reply Last reply
                1

                • Login

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