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. Why when i build the project at that time why compiler gives error ?
Forum Updated to NodeBB v4.3 + New Features

Why when i build the project at that time why compiler gives error ?

Scheduled Pinned Locked Moved Solved General and Desktop
22 Posts 6 Posters 2.5k 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by Qt embedded developer
    #1

    I have created multiple .pro file to create my project

    Here i have my main pro file content is

    TEMPLATE = SUBDIRS
    
    SUBDIRS += \
        App \
        Components
    
    
    #########################################################################
    # Specify dependencies
    App.depends = Components
    

    The first sub dir project App's content is

    #########################################################################
    # Define project specific QT settings
    TEMPLATE = app
    
    TARGET = App
    
    QT          += qml
    QT          += quick
    QT          += core
    QT          += widgets
    QT          += websockets
    
    CONFIG      += c++17
    
    
    DEFINES += QT_DEPRECATED_WARNINGS
    
    
    DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
    
    
    RESOURCES += \
        Gui/qml.qrc
    
    QML_IMPORT_PATH += $$PWD/Gui/
    
    SOURCES += \
        Main.cpp
    
    INCLUDEPATH += $$PWD/../Components
    INCLUDEPATH += $$PWD/../Components/Utility
    
    DEPENDPATH += $$PWD/../Components
    
    

    And the second subdir project content is

    TEMPLATE    = app
    QT          += quick
    QT          += core
    QT          += websockets
    QT          += widgets
    
    CONFIG      += c++17
    CONFIG      += staticlib
    
    DEFINES += QT_DEPRECATED_WARNINGS
    
    
    DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    HEADERS += \
        MainApplication.h \
        Utility/QmlEngineUtility.h
    
    SOURCES += \
        MainApplication.cpp \
        Utility/QmlEngineUtility.cpp
    

    Errors

    :-1: warning: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile: No such file or directory
    
    :-1: error: No rule to make target '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile'.  Stop.
    
    
    14:31:07: Running steps for project UiDirectoryStructure...
    14:31:07: Starting: "/home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake" /home/host/HOST/TWS_11_02_2024/14FEB2024/UiDirectoryStructure/UiDirectoryStructure.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
    WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
    QIODevice::write: device not open
    14:31:07: The process "/home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake" exited normally.
    14:31:07: Starting: "/usr/bin/make" -f /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile qmake_all
    make: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile: No such file or directory
    make: *** No rule to make target '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile'.  Stop.
    14:31:07: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit)
    When executing step "qmake"
    14:31:07: Elapsed time: 00:00.
    

    Can any body help me how to resolve this error ?

    jsulmJ 2 Replies Last reply
    0
    • Q Qt embedded developer

      @SGaist

      TEMPLATE = subdirs
      
      SUBDIRS += \
          App \
          Components
      
      # Specify dependencies
      App.depends = Components
      
      The first sub dir project App's content is
      
          #########################################################################
          # Define project specific QT settings
          TEMPLATE = app
      
          TARGET = App
      
          QT          += qml
          QT          += quick
          QT          += core
          QT          += widgets
          QT          += websockets
      
          CONFIG      += c++17
      
      
          DEFINES += QT_DEPRECATED_WARNINGS
      
      
          DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
      
      
          RESOURCES += \
              Gui/qml.qrc
      
          QML_IMPORT_PATH += $$PWD/Gui/
      
          SOURCES += \
              Main.cpp
      
          INCLUDEPATH += $$PWD/../Components
          INCLUDEPATH += $$PWD/../Components/Utility
      
          DEPENDPATH += $$PWD/../Components
      
      And the second subdir project content is
      
      ```
      

      TEMPLATE = app
      QT += quick
      QT += core
      QT += websockets
      QT += widgets

      CONFIG      += c++17
      CONFIG      += staticlib
      
      DEFINES += QT_DEPRECATED_WARNINGS
      
      
      DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
      
      HEADERS += \
          MainApplication.h \
          Utility/QmlEngineUtility.h
      
      SOURCES += \
          MainApplication.cpp \
          Utility/QmlEngineUtility.cpp
      
      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #22

      @Qt-embedded-developer I do not understand your second subproject PRO file. It uses
      TEMPLATE = app
      and simultaneously
      CONFIG += staticlib

      The CONFIG option staticlib means,

      The target is a static library (lib only). The proper compiler flags will automatically be added to the project.

      The target is either an application or a library, not both.

      1 Reply Last reply
      3
      • Q Qt embedded developer

        I have created multiple .pro file to create my project

        Here i have my main pro file content is

        TEMPLATE = SUBDIRS
        
        SUBDIRS += \
            App \
            Components
        
        
        #########################################################################
        # Specify dependencies
        App.depends = Components
        

        The first sub dir project App's content is

        #########################################################################
        # Define project specific QT settings
        TEMPLATE = app
        
        TARGET = App
        
        QT          += qml
        QT          += quick
        QT          += core
        QT          += widgets
        QT          += websockets
        
        CONFIG      += c++17
        
        
        DEFINES += QT_DEPRECATED_WARNINGS
        
        
        DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
        
        
        RESOURCES += \
            Gui/qml.qrc
        
        QML_IMPORT_PATH += $$PWD/Gui/
        
        SOURCES += \
            Main.cpp
        
        INCLUDEPATH += $$PWD/../Components
        INCLUDEPATH += $$PWD/../Components/Utility
        
        DEPENDPATH += $$PWD/../Components
        
        

        And the second subdir project content is

        TEMPLATE    = app
        QT          += quick
        QT          += core
        QT          += websockets
        QT          += widgets
        
        CONFIG      += c++17
        CONFIG      += staticlib
        
        DEFINES += QT_DEPRECATED_WARNINGS
        
        
        DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
        
        HEADERS += \
            MainApplication.h \
            Utility/QmlEngineUtility.h
        
        SOURCES += \
            MainApplication.cpp \
            Utility/QmlEngineUtility.cpp
        

        Errors

        :-1: warning: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile: No such file or directory
        
        :-1: error: No rule to make target '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile'.  Stop.
        
        
        14:31:07: Running steps for project UiDirectoryStructure...
        14:31:07: Starting: "/home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake" /home/host/HOST/TWS_11_02_2024/14FEB2024/UiDirectoryStructure/UiDirectoryStructure.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
        WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
        QIODevice::write: device not open
        14:31:07: The process "/home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake" exited normally.
        14:31:07: Starting: "/usr/bin/make" -f /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile qmake_all
        make: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile: No such file or directory
        make: *** No rule to make target '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile'.  Stop.
        14:31:07: The process "/usr/bin/make" exited with code 2.
        Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit)
        When executing step "qmake"
        14:31:07: Elapsed time: 00:00.
        

        Can any body help me how to resolve this error ?

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

        @Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:

        WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
        QIODevice::write: device not open

        Looks like qmake is not able to write in the build folder.
        Is your drive full? Or mounted read-only? Or corrupted?

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

        1 Reply Last reply
        2
        • Q Qt embedded developer

          I have created multiple .pro file to create my project

          Here i have my main pro file content is

          TEMPLATE = SUBDIRS
          
          SUBDIRS += \
              App \
              Components
          
          
          #########################################################################
          # Specify dependencies
          App.depends = Components
          

          The first sub dir project App's content is

          #########################################################################
          # Define project specific QT settings
          TEMPLATE = app
          
          TARGET = App
          
          QT          += qml
          QT          += quick
          QT          += core
          QT          += widgets
          QT          += websockets
          
          CONFIG      += c++17
          
          
          DEFINES += QT_DEPRECATED_WARNINGS
          
          
          DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
          
          
          RESOURCES += \
              Gui/qml.qrc
          
          QML_IMPORT_PATH += $$PWD/Gui/
          
          SOURCES += \
              Main.cpp
          
          INCLUDEPATH += $$PWD/../Components
          INCLUDEPATH += $$PWD/../Components/Utility
          
          DEPENDPATH += $$PWD/../Components
          
          

          And the second subdir project content is

          TEMPLATE    = app
          QT          += quick
          QT          += core
          QT          += websockets
          QT          += widgets
          
          CONFIG      += c++17
          CONFIG      += staticlib
          
          DEFINES += QT_DEPRECATED_WARNINGS
          
          
          DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
          
          HEADERS += \
              MainApplication.h \
              Utility/QmlEngineUtility.h
          
          SOURCES += \
              MainApplication.cpp \
              Utility/QmlEngineUtility.cpp
          

          Errors

          :-1: warning: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile: No such file or directory
          
          :-1: error: No rule to make target '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile'.  Stop.
          
          
          14:31:07: Running steps for project UiDirectoryStructure...
          14:31:07: Starting: "/home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake" /home/host/HOST/TWS_11_02_2024/14FEB2024/UiDirectoryStructure/UiDirectoryStructure.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
          WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
          QIODevice::write: device not open
          14:31:07: The process "/home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake" exited normally.
          14:31:07: Starting: "/usr/bin/make" -f /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile qmake_all
          make: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile: No such file or directory
          make: *** No rule to make target '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile'.  Stop.
          14:31:07: The process "/usr/bin/make" exited with code 2.
          Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit)
          When executing step "qmake"
          14:31:07: Elapsed time: 00:00.
          

          Can any body help me how to resolve this error ?

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

          @Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:

          WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]

          Also the [TEMPLATE SUBDIRS] part in the path is strange: why is it there? Show your pro file(s).

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

          Q 1 Reply Last reply
          1
          • jsulmJ jsulm

            @Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:

            WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]

            Also the [TEMPLATE SUBDIRS] part in the path is strange: why is it there? Show your pro file(s).

            Q Offline
            Q Offline
            Qt embedded developer
            wrote on last edited by Qt embedded developer
            #4

            @jsulm Hi i have update the my question and shown the .pro file there.

            Can you guide what changes i need to make so it works correctly ?

            jsulmJ 1 Reply Last reply
            0
            • Q Qt embedded developer

              @jsulm Hi i have update the my question and shown the .pro file there.

              Can you guide what changes i need to make so it works correctly ?

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

              @Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:

              Can you guide what changes i need to make so it works correctly ?

              First answer questions I asked before:

              • Is your drive full?
              • Or mounted read-only?
              • Or corrupted?
              • Also the [TEMPLATE SUBDIRS] part in the path is strange: why is it there?

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

              Q 1 Reply Last reply
              0
              • jsulmJ jsulm

                @Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:

                Can you guide what changes i need to make so it works correctly ?

                First answer questions I asked before:

                • Is your drive full?
                • Or mounted read-only?
                • Or corrupted?
                • Also the [TEMPLATE SUBDIRS] part in the path is strange: why is it there?
                Q Offline
                Q Offline
                Qt embedded developer
                wrote on last edited by
                #6

                @jsulm said in Why when i build the project at that time why qmke gives error ?:

                Is your drive full?
                Or mounted read-only?
                Or corrupted?
                Also the [TEMPLATE SUBDIRS] part in the path is strange: why is it there?

                1] No
                2] no
                3] no. different project work but just this project not working

                jsulmJ 1 Reply Last reply
                0
                • Q Qt embedded developer

                  @jsulm said in Why when i build the project at that time why qmke gives error ?:

                  Is your drive full?
                  Or mounted read-only?
                  Or corrupted?
                  Also the [TEMPLATE SUBDIRS] part in the path is strange: why is it there?

                  1] No
                  2] no
                  3] no. different project work but just this project not working

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

                  @Qt-embedded-developer I asked 4 questions...
                  Again: why is there "[TEMPLATE SUBDIRS]" in /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS] ?

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

                  Q 1 Reply Last reply
                  1
                  • jsulmJ jsulm

                    @Qt-embedded-developer I asked 4 questions...
                    Again: why is there "[TEMPLATE SUBDIRS]" in /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS] ?

                    Q Offline
                    Q Offline
                    Qt embedded developer
                    wrote on last edited by Qt embedded developer
                    #8

                    @jsulm Actually I have take reference of other project. And i have to create structure of that project like it.

                    So my answer is due to reference. but technically i don't know it's correct or not . But I want to know how to make it correct.

                    So initially i take emty qmake project. and then in same project manually wrote subdir project because it's in reference project.

                    So Actually i have to create structure like

                    MainProject
                    -mainproj.pro
                    Appproject(template App)
                    -App.pro
                    -sources
                    main.cpp
                    -qrc
                    Main.qml
                    Componentproject (template lib)
                    -Component.pro
                    -sources

                    • common
                      -file.cpp
                      -Header
                    • common
                      -file.h
                      MainApplication.cpp
                      MainApplication.h
                    SGaistS 1 Reply Last reply
                    0
                    • Q Qt embedded developer

                      @jsulm Actually I have take reference of other project. And i have to create structure of that project like it.

                      So my answer is due to reference. but technically i don't know it's correct or not . But I want to know how to make it correct.

                      So initially i take emty qmake project. and then in same project manually wrote subdir project because it's in reference project.

                      So Actually i have to create structure like

                      MainProject
                      -mainproj.pro
                      Appproject(template App)
                      -App.pro
                      -sources
                      main.cpp
                      -qrc
                      Main.qml
                      Componentproject (template lib)
                      -Component.pro
                      -sources

                      • common
                        -file.cpp
                        -Header
                      • common
                        -file.h
                        MainApplication.cpp
                        MainApplication.h
                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      @Qt-embedded-developer hi,

                      Do you really have "(template XXX)" as part of the folder name ? If so, remove that.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      Q 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        @Qt-embedded-developer hi,

                        Do you really have "(template XXX)" as part of the folder name ? If so, remove that.

                        Q Offline
                        Q Offline
                        Qt embedded developer
                        wrote on last edited by Qt embedded developer
                        #10

                        @SGaist Actually i want understand that how you get thought that "template XXX". because i can not able to find where exactly the change is needed.

                        i don't have folder template XXX

                        @SGaist @jsulm I want to become expert of creating any type of project structure. So can you guide how i should start ?

                        SGaistS jsulmJ 2 Replies Last reply
                        0
                        • Q Qt embedded developer

                          @SGaist Actually i want understand that how you get thought that "template XXX". because i can not able to find where exactly the change is needed.

                          i don't have folder template XXX

                          @SGaist @jsulm I want to become expert of creating any type of project structure. So can you guide how i should start ?

                          SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #11

                          @Qt-embedded-developer Show the exact structure you have on disk.

                          As @jsulm already pointed the fact that there's [TEMPLATE SUBDIRS] that appears in your compiler logs is suspicious. Do you have that string anywhere in your project files ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          1
                          • Q Qt embedded developer

                            @SGaist Actually i want understand that how you get thought that "template XXX". because i can not able to find where exactly the change is needed.

                            i don't have folder template XXX

                            @SGaist @jsulm I want to become expert of creating any type of project structure. So can you guide how i should start ?

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

                            @Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:

                            i don't have folder template XXX

                            Then what is this:

                            WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
                            

                            ?

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

                            JonBJ 1 Reply Last reply
                            1
                            • jsulmJ jsulm

                              @Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:

                              i don't have folder template XXX

                              Then what is this:

                              WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
                              

                              ?

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote on last edited by JonB
                              #13

                              @jsulm @Qt-embedded-developer , @jsulm, @SGaist

                              Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]

                              TEMPLATE = SUBDIRS

                              Setup SUBDIRS template failed in QtCreator from 10 years ago (good Qt answers never fade!):

                              It should be TEMPLATE = subdirs, not SUBDIR

                              Use TEMPLATE = subdirs instead of TEMPLATE = SUBDIRS, i.e. not upper case letters..

                              :)

                              Q 1 Reply Last reply
                              5
                              • JonBJ JonB

                                @jsulm @Qt-embedded-developer , @jsulm, @SGaist

                                Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]

                                TEMPLATE = SUBDIRS

                                Setup SUBDIRS template failed in QtCreator from 10 years ago (good Qt answers never fade!):

                                It should be TEMPLATE = subdirs, not SUBDIR

                                Use TEMPLATE = subdirs instead of TEMPLATE = SUBDIRS, i.e. not upper case letters..

                                :)

                                Q Offline
                                Q Offline
                                Qt embedded developer
                                wrote on last edited by Qt embedded developer
                                #14

                                @JonB said in Why when i build the project at that time why compiler gives error ?:

                                @jsulm, @SGaist

                                when now i am run this complete project i am getting below errors

                                On the issue tab it give the below error:

                                :-1: error: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o: in function `_start':

                                (.text+0x1b):-1: error: undefined reference to `main'

                                :-1: error: collect2: error: ld returned 1 exit status

                                :-1: error: [Makefile:253: Components] Error 1

                                Compiler gives the below errors:

                                /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o: in function _start': (.text+0x1b): undefined reference to main'
                                collect2: error: ld returned 1 exit status
                                make[1]: Leaving directory '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Components'
                                make[1]: *** [Makefile:253: Components] Error 1
                                make: *** [Makefile:73: sub-Components-make_first] Error 2
                                14:54:56: The process "/usr/bin/make" exited with code 2.
                                Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit)
                                When executing step "Make"

                                I want to become expert of creating any type of project structure. So can anybody guide how i should start ?

                                @jsulm, @SGaist @JonB Thank you for several time contribution in several post of mine

                                JonBJ 1 Reply Last reply
                                1
                                • Q Qt embedded developer

                                  @JonB said in Why when i build the project at that time why compiler gives error ?:

                                  @jsulm, @SGaist

                                  when now i am run this complete project i am getting below errors

                                  On the issue tab it give the below error:

                                  :-1: error: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o: in function `_start':

                                  (.text+0x1b):-1: error: undefined reference to `main'

                                  :-1: error: collect2: error: ld returned 1 exit status

                                  :-1: error: [Makefile:253: Components] Error 1

                                  Compiler gives the below errors:

                                  /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o: in function _start': (.text+0x1b): undefined reference to main'
                                  collect2: error: ld returned 1 exit status
                                  make[1]: Leaving directory '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Components'
                                  make[1]: *** [Makefile:253: Components] Error 1
                                  make: *** [Makefile:73: sub-Components-make_first] Error 2
                                  14:54:56: The process "/usr/bin/make" exited with code 2.
                                  Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit)
                                  When executing step "Make"

                                  I want to become expert of creating any type of project structure. So can anybody guide how i should start ?

                                  @jsulm, @SGaist @JonB Thank you for several time contribution in several post of mine

                                  JonBJ Offline
                                  JonBJ Offline
                                  JonB
                                  wrote on last edited by
                                  #15

                                  @Qt-embedded-developer
                                  The system's lib64/crt1.o is the entry point when your program is started. That will call its _start() function, and that in turn will expect to call your program's main(). But the error message says it cannot find any such main(). Which implies your linker command does not include your main program.

                                  I have never used a subdirs project, sounds like that is not correctly picking up your main program. You could show the complete linker command (Compile Output pane, the last line where it does the linking). Probably needs someone who knows how subdirs project is supposed to work....

                                  Q 1 Reply Last reply
                                  0
                                  • JonBJ JonB

                                    @Qt-embedded-developer
                                    The system's lib64/crt1.o is the entry point when your program is started. That will call its _start() function, and that in turn will expect to call your program's main(). But the error message says it cannot find any such main(). Which implies your linker command does not include your main program.

                                    I have never used a subdirs project, sounds like that is not correctly picking up your main program. You could show the complete linker command (Compile Output pane, the last line where it does the linking). Probably needs someone who knows how subdirs project is supposed to work....

                                    Q Offline
                                    Q Offline
                                    Qt embedded developer
                                    wrote on last edited by Qt embedded developer
                                    #16

                                    @JonB Hi My compiler out put is :

                                    cd Components/ && ( test -e Makefile || /home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake -o Makefile /home/host/P_host/TWS_11_02_2024/14FEB2024/UiDirectoryStructure/Components/Components.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug ) && /usr/bin/make -f Makefile
                                    make[1]: Entering directory '/home/host/P_host/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Components'
                                    g++ -o Components MainApplication.o QmlEngineUtility.o moc_MainApplication.o moc_QmlEngineUtility.o /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Quick.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Widgets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Gui.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5QmlModels.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Qml.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5WebSockets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Network.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Core.so -lGL -lpthread
                                    /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o: in function _start': (.text+0x1b): undefined reference to main'
                                    collect2: error: ld returned 1 exit status
                                    make[1]: Leaving directory '/home/host/P_host/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Components'
                                    make[1]: *** [Makefile:253: Components] Error 1
                                    make: *** [Makefile:73: sub-Components-make_first] Error 2
                                    16:27:37: The process "/usr/bin/make" exited with code 2.
                                    Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit)
                                    When executing step "Make"
                                    16:27:37: Elapsed time: 00:00.

                                    I can able to see that my app folder's main.cpp not included when below command :

                                    g++ -o Components MainApplication.o QmlEngineUtility.o moc_MainApplication.o moc_QmlEngineUtility.o /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Quick.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Widgets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Gui.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5QmlModels.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Qml.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5WebSockets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Network.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Core.so -lGL -lpthread

                                    try to build. but i don't know how to allow my main.cpp also. why it automatically not get taken. becuase my main is in main.cpp

                                    i have created my source code such that the except main.cpp of App project is in Component project. so when i need to write unittest then it help. and as well as i want to link my component connect with app project using static library.

                                    So what changes i need to do ?

                                    JonBJ 1 Reply Last reply
                                    0
                                    • Q Qt embedded developer

                                      @JonB Hi My compiler out put is :

                                      cd Components/ && ( test -e Makefile || /home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake -o Makefile /home/host/P_host/TWS_11_02_2024/14FEB2024/UiDirectoryStructure/Components/Components.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug ) && /usr/bin/make -f Makefile
                                      make[1]: Entering directory '/home/host/P_host/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Components'
                                      g++ -o Components MainApplication.o QmlEngineUtility.o moc_MainApplication.o moc_QmlEngineUtility.o /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Quick.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Widgets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Gui.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5QmlModels.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Qml.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5WebSockets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Network.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Core.so -lGL -lpthread
                                      /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o: in function _start': (.text+0x1b): undefined reference to main'
                                      collect2: error: ld returned 1 exit status
                                      make[1]: Leaving directory '/home/host/P_host/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Components'
                                      make[1]: *** [Makefile:253: Components] Error 1
                                      make: *** [Makefile:73: sub-Components-make_first] Error 2
                                      16:27:37: The process "/usr/bin/make" exited with code 2.
                                      Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit)
                                      When executing step "Make"
                                      16:27:37: Elapsed time: 00:00.

                                      I can able to see that my app folder's main.cpp not included when below command :

                                      g++ -o Components MainApplication.o QmlEngineUtility.o moc_MainApplication.o moc_QmlEngineUtility.o /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Quick.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Widgets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Gui.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5QmlModels.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Qml.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5WebSockets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Network.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Core.so -lGL -lpthread

                                      try to build. but i don't know how to allow my main.cpp also. why it automatically not get taken. becuase my main is in main.cpp

                                      i have created my source code such that the except main.cpp of App project is in Component project. so when i need to write unittest then it help. and as well as i want to link my component connect with app project using static library.

                                      So what changes i need to do ?

                                      JonBJ Offline
                                      JonBJ Offline
                                      JonB
                                      wrote on last edited by JonB
                                      #17

                                      @Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:

                                      try to build. but i don't know how to allow my main.cpp also. why it automatically not get taken. becuase my main is in main.cpp

                                      And that is your problem. Like I said, I have never used a subdirs project. But I imagine that has some "main" project, which has your main.cpp in it. Are you building that top-level, main project, or are you perhaps only building one of the subprojects, which will not have a main?

                                      Q 1 Reply Last reply
                                      0
                                      • JonBJ JonB

                                        @Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:

                                        try to build. but i don't know how to allow my main.cpp also. why it automatically not get taken. becuase my main is in main.cpp

                                        And that is your problem. Like I said, I have never used a subdirs project. But I imagine that has some "main" project, which has your main.cpp in it. Are you building that top-level, main project, or are you perhaps only building one of the subprojects, which will not have a main?

                                        Q Offline
                                        Q Offline
                                        Qt embedded developer
                                        wrote on last edited by Qt embedded developer
                                        #18

                                        @JonB I am right clicking on active project name and then i am building it.

                                        I have shared the main.pro file in main question. where i have added two sub project app and components.

                                        SGaistS 1 Reply Last reply
                                        0
                                        • Q Qt embedded developer

                                          @JonB I am right clicking on active project name and then i am building it.

                                          I have shared the main.pro file in main question. where i have added two sub project app and components.

                                          SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #19

                                          Share your other .pro files so we can see what is going on.

                                          Interested in AI ? www.idiap.ch
                                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          Q 1 Reply Last reply
                                          0
                                          • SGaistS SGaist

                                            Share your other .pro files so we can see what is going on.

                                            Q Offline
                                            Q Offline
                                            Qt embedded developer
                                            wrote on last edited by
                                            #20

                                            @SGaist

                                            TEMPLATE = subdirs
                                            
                                            SUBDIRS += \
                                                App \
                                                Components
                                            
                                            # Specify dependencies
                                            App.depends = Components
                                            
                                            The first sub dir project App's content is
                                            
                                                #########################################################################
                                                # Define project specific QT settings
                                                TEMPLATE = app
                                            
                                                TARGET = App
                                            
                                                QT          += qml
                                                QT          += quick
                                                QT          += core
                                                QT          += widgets
                                                QT          += websockets
                                            
                                                CONFIG      += c++17
                                            
                                            
                                                DEFINES += QT_DEPRECATED_WARNINGS
                                            
                                            
                                                DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
                                            
                                            
                                                RESOURCES += \
                                                    Gui/qml.qrc
                                            
                                                QML_IMPORT_PATH += $$PWD/Gui/
                                            
                                                SOURCES += \
                                                    Main.cpp
                                            
                                                INCLUDEPATH += $$PWD/../Components
                                                INCLUDEPATH += $$PWD/../Components/Utility
                                            
                                                DEPENDPATH += $$PWD/../Components
                                            
                                            And the second subdir project content is
                                            
                                            ```
                                            

                                            TEMPLATE = app
                                            QT += quick
                                            QT += core
                                            QT += websockets
                                            QT += widgets

                                            CONFIG      += c++17
                                            CONFIG      += staticlib
                                            
                                            DEFINES += QT_DEPRECATED_WARNINGS
                                            
                                            
                                            DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                                            
                                            HEADERS += \
                                                MainApplication.h \
                                                Utility/QmlEngineUtility.h
                                            
                                            SOURCES += \
                                                MainApplication.cpp \
                                                Utility/QmlEngineUtility.cpp
                                            
                                            A C 2 Replies 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