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. g++: error: /DEBUG: No such file or directory
QtWS25 Last Chance

g++: error: /DEBUG: No such file or directory

Scheduled Pinned Locked Moved Solved Installation and Deployment
linker errorsqmakemakefile.debugmakefile errormingw
8 Posts 4 Posters 1.3k 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.
  • J Offline
    J Offline
    joej
    wrote on 14 Dec 2023, 08:48 last edited by
    #1

    Hello,

    I am trying to rebuild an old project that an ex-employee used to work on it. I have a new Windows machine and made a default installation of Qt 5.12.12. I use Qt Creator 5.0.2.

    When I load the project and press build, the sources seem to compile fine but
    after executing the command (as defined in the generated Makefile.Debug):

    g++ -Wl,-subsystem,windows /DEBUG -mthreads -o debug\Camera.exe @object_script.Camera.Debug  C:\Qt\Qt5.12.12\5.12.12\mingw73_64\lib\libQt5Widgetsd.a C:\Qt\Qt5.12.12\5.12.12\mingw73_64\lib\libQt5Guid.a C:\Qt\Qt5.12.12\5.12.12\mingw73_64\lib\libQt5Cored.a debug\win_resources_res.o  -lmingw32 C:\Qt\Qt5.12.12\5.12.12\mingw73_64\lib\libqtmaind.a -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.6.11-winx64\lib -LC:\Utils\postgresql\pgsql\lib -lshell32
    

    the linker complains

    g++: error: /DEBUG: No such file or directory
    

    After inspection I found out that this command is defined in Makefile.Debug on line 129:

    $(LINKER) $(LFLAGS) -o $(DESTDIR_TARGET) @object_script.Camera.Debug  $(LIBS)
    

    with previously defined LINKER and LFLAGS in the same Makefile.Debug file:

    LINKER  =   g++
    LFLAGS  =  -Wl,-subsystem,windows /DEBUG -mthreads
    

    I speculate /DEBUG referes to the newly created folder after compile step containing .o files. This folder indeed exists.

    • If I change /DEBUG to DEBUG\main.o, then I get an error message that some functions have multiple definitions. This makes sense because object_script.Camera.Debug file contains a list of .o files in /debug folder so main.o is basically called twice.

    • If I change /DEBUG to DEBUG, I get a message: cannot find DEBUG: Permission denied.

    • If I remove /DEBUG, then linking process continues until eventually throwing an undefined reference error but this is the source code fault which I need to address.

    However, after re-running qmake, the /DEBUG is added back to the Makefile.Debug. I am wondering what is the purpose of /DEBUG argument? I don't believe manually removing it is a way to go.

    J C 2 Replies Last reply 14 Dec 2023, 08:53
    0
    • J joej
      14 Dec 2023, 09:25

      @jsulm
      I don't have whitespaces in directory names.

      @Christian-Ehrlicher Makefile.Debug (which is where /DEBUG option is introduced) is generated by qmake. So do you have any idea how do I instruct qmake not to add /DEBUG?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 14 Dec 2023, 09:27 last edited by
      #5

      @joej said in g++: error: /DEBUG: No such file or directory:

      So do you have any idea how do I instruct qmake not to add /DEBUG?

      Check the pro file - it was probably added there. qmake should not add such parameters for MinGW version of Qt.

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

      J 1 Reply Last reply 14 Dec 2023, 10:30
      1
      • J joej
        14 Dec 2023, 08:48

        Hello,

        I am trying to rebuild an old project that an ex-employee used to work on it. I have a new Windows machine and made a default installation of Qt 5.12.12. I use Qt Creator 5.0.2.

        When I load the project and press build, the sources seem to compile fine but
        after executing the command (as defined in the generated Makefile.Debug):

        g++ -Wl,-subsystem,windows /DEBUG -mthreads -o debug\Camera.exe @object_script.Camera.Debug  C:\Qt\Qt5.12.12\5.12.12\mingw73_64\lib\libQt5Widgetsd.a C:\Qt\Qt5.12.12\5.12.12\mingw73_64\lib\libQt5Guid.a C:\Qt\Qt5.12.12\5.12.12\mingw73_64\lib\libQt5Cored.a debug\win_resources_res.o  -lmingw32 C:\Qt\Qt5.12.12\5.12.12\mingw73_64\lib\libqtmaind.a -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.6.11-winx64\lib -LC:\Utils\postgresql\pgsql\lib -lshell32
        

        the linker complains

        g++: error: /DEBUG: No such file or directory
        

        After inspection I found out that this command is defined in Makefile.Debug on line 129:

        $(LINKER) $(LFLAGS) -o $(DESTDIR_TARGET) @object_script.Camera.Debug  $(LIBS)
        

        with previously defined LINKER and LFLAGS in the same Makefile.Debug file:

        LINKER  =   g++
        LFLAGS  =  -Wl,-subsystem,windows /DEBUG -mthreads
        

        I speculate /DEBUG referes to the newly created folder after compile step containing .o files. This folder indeed exists.

        • If I change /DEBUG to DEBUG\main.o, then I get an error message that some functions have multiple definitions. This makes sense because object_script.Camera.Debug file contains a list of .o files in /debug folder so main.o is basically called twice.

        • If I change /DEBUG to DEBUG, I get a message: cannot find DEBUG: Permission denied.

        • If I remove /DEBUG, then linking process continues until eventually throwing an undefined reference error but this is the source code fault which I need to address.

        However, after re-running qmake, the /DEBUG is added back to the Makefile.Debug. I am wondering what is the purpose of /DEBUG argument? I don't believe manually removing it is a way to go.

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 14 Dec 2023, 08:53 last edited by
        #2

        @joej Issue could be that you (maybe) have paths with spaces. You should avoid such patchs.

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

        1 Reply Last reply
        0
        • J joej
          14 Dec 2023, 08:48

          Hello,

          I am trying to rebuild an old project that an ex-employee used to work on it. I have a new Windows machine and made a default installation of Qt 5.12.12. I use Qt Creator 5.0.2.

          When I load the project and press build, the sources seem to compile fine but
          after executing the command (as defined in the generated Makefile.Debug):

          g++ -Wl,-subsystem,windows /DEBUG -mthreads -o debug\Camera.exe @object_script.Camera.Debug  C:\Qt\Qt5.12.12\5.12.12\mingw73_64\lib\libQt5Widgetsd.a C:\Qt\Qt5.12.12\5.12.12\mingw73_64\lib\libQt5Guid.a C:\Qt\Qt5.12.12\5.12.12\mingw73_64\lib\libQt5Cored.a debug\win_resources_res.o  -lmingw32 C:\Qt\Qt5.12.12\5.12.12\mingw73_64\lib\libqtmaind.a -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.6.11-winx64\lib -LC:\Utils\postgresql\pgsql\lib -lshell32
          

          the linker complains

          g++: error: /DEBUG: No such file or directory
          

          After inspection I found out that this command is defined in Makefile.Debug on line 129:

          $(LINKER) $(LFLAGS) -o $(DESTDIR_TARGET) @object_script.Camera.Debug  $(LIBS)
          

          with previously defined LINKER and LFLAGS in the same Makefile.Debug file:

          LINKER  =   g++
          LFLAGS  =  -Wl,-subsystem,windows /DEBUG -mthreads
          

          I speculate /DEBUG referes to the newly created folder after compile step containing .o files. This folder indeed exists.

          • If I change /DEBUG to DEBUG\main.o, then I get an error message that some functions have multiple definitions. This makes sense because object_script.Camera.Debug file contains a list of .o files in /debug folder so main.o is basically called twice.

          • If I change /DEBUG to DEBUG, I get a message: cannot find DEBUG: Permission denied.

          • If I remove /DEBUG, then linking process continues until eventually throwing an undefined reference error but this is the source code fault which I need to address.

          However, after re-running qmake, the /DEBUG is added back to the Makefile.Debug. I am wondering what is the purpose of /DEBUG argument? I don't believe manually removing it is a way to go.

          C Online
          C Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 14 Dec 2023, 09:00 last edited by
          #3

          @joej said in g++: error: /DEBUG: No such file or directory:

          LFLAGS = -Wl,-subsystem,windows /DEBUG -mthreads

          /DEBUG is not a g++ option...

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          J 1 Reply Last reply 14 Dec 2023, 09:25
          3
          • C Christian Ehrlicher
            14 Dec 2023, 09:00

            @joej said in g++: error: /DEBUG: No such file or directory:

            LFLAGS = -Wl,-subsystem,windows /DEBUG -mthreads

            /DEBUG is not a g++ option...

            J Offline
            J Offline
            joej
            wrote on 14 Dec 2023, 09:25 last edited by
            #4

            @jsulm
            I don't have whitespaces in directory names.

            @Christian-Ehrlicher Makefile.Debug (which is where /DEBUG option is introduced) is generated by qmake. So do you have any idea how do I instruct qmake not to add /DEBUG?

            J 1 Reply Last reply 14 Dec 2023, 09:27
            0
            • J joej
              14 Dec 2023, 09:25

              @jsulm
              I don't have whitespaces in directory names.

              @Christian-Ehrlicher Makefile.Debug (which is where /DEBUG option is introduced) is generated by qmake. So do you have any idea how do I instruct qmake not to add /DEBUG?

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 14 Dec 2023, 09:27 last edited by
              #5

              @joej said in g++: error: /DEBUG: No such file or directory:

              So do you have any idea how do I instruct qmake not to add /DEBUG?

              Check the pro file - it was probably added there. qmake should not add such parameters for MinGW version of Qt.

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

              J 1 Reply Last reply 14 Dec 2023, 10:30
              1
              • J jsulm
                14 Dec 2023, 09:27

                @joej said in g++: error: /DEBUG: No such file or directory:

                So do you have any idea how do I instruct qmake not to add /DEBUG?

                Check the pro file - it was probably added there. qmake should not add such parameters for MinGW version of Qt.

                J Offline
                J Offline
                joej
                wrote on 14 Dec 2023, 10:30 last edited by
                #6

                @jsulm

                You are absolutely right. There was a line in .pro file:
                QMAKE_LFLAGS_WINDOWS += /DEBUG

                After removing it. /DEBUG flag is not added to the Makefile anymore. Thank you for that brilliant tip!

                I actually noticed some hints that the previous developer might have used MSVC instead of MinGW. However, I was not able to setup Qt to use MSVC on my current machine as it was complaining that MSVC compiler (x86-windows-msvc2005-pe-32bit) cannot produce code for "Qt 5.12.12 MSVC2017 32bit" so I gave up.

                J J 2 Replies Last reply 14 Dec 2023, 10:39
                0
                • J joej
                  14 Dec 2023, 10:30

                  @jsulm

                  You are absolutely right. There was a line in .pro file:
                  QMAKE_LFLAGS_WINDOWS += /DEBUG

                  After removing it. /DEBUG flag is not added to the Makefile anymore. Thank you for that brilliant tip!

                  I actually noticed some hints that the previous developer might have used MSVC instead of MinGW. However, I was not able to setup Qt to use MSVC on my current machine as it was complaining that MSVC compiler (x86-windows-msvc2005-pe-32bit) cannot produce code for "Qt 5.12.12 MSVC2017 32bit" so I gave up.

                  J Online
                  J Online
                  JonB
                  wrote on 14 Dec 2023, 10:39 last edited by
                  #7

                  @joej Yes, /DEBUG was always for MSVC, only.

                  1 Reply Last reply
                  0
                  • J joej has marked this topic as solved on 14 Dec 2023, 11:42
                  • J joej
                    14 Dec 2023, 10:30

                    @jsulm

                    You are absolutely right. There was a line in .pro file:
                    QMAKE_LFLAGS_WINDOWS += /DEBUG

                    After removing it. /DEBUG flag is not added to the Makefile anymore. Thank you for that brilliant tip!

                    I actually noticed some hints that the previous developer might have used MSVC instead of MinGW. However, I was not able to setup Qt to use MSVC on my current machine as it was complaining that MSVC compiler (x86-windows-msvc2005-pe-32bit) cannot produce code for "Qt 5.12.12 MSVC2017 32bit" so I gave up.

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 14 Dec 2023, 14:37 last edited by
                    #8

                    @joej said in g++: error: /DEBUG: No such file or directory:

                    MSVC compiler (x86-windows-msvc2005-pe-32bit) cannot produce code for "Qt 5.12.12 MSVC2017 32bit"

                    Use newer MSVC compiler

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

                    1 Reply Last reply
                    0

                    8/8

                    14 Dec 2023, 14:37

                    • Login

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