g++: error: /DEBUG: No such file or directory
-
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 becauseobject_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. -
-
@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.
-
@joej said in g++: error: /DEBUG: No such file or directory:
LFLAGS = -Wl,-subsystem,windows /DEBUG -mthreads
/DEBUG
is not a g++ option... -
@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?
-
@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.
-
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.
-
-
@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