You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, February 6th 2013, 5:58am

error compiling, wrong slash used in Makefile.Debug

I installed qt 5.0.1 mingw 32 bit binary from qt download page.
I am having trouble compiling a fresh project.

my project name is helloworld-console and the main file is main.cpp created for me by the IDE
it's a simple hello world program

Source code

1
2
3
4
5
6
7
#include <iostream>
using namespace std;
int main()
{
	cout << "Hello World!" << endl;
	return 0;
}


This is the output

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
23:49:46: Running steps for project helloworld-console...
23:49:46: Starting: 
"C:\Qt\Qt5.0.1\5.0.1\mingw47_32\bin\qmake.exe" 
C:\backup\code\Qt-code\helloworld-console\helloworld-console.pro -r 
-spec win32-g++ "CONFIG+=debug" "CONFIG+=declarative_debug" 
"CONFIG+=qml_debug"
23:49:46: The process "C:\Qt\Qt5.0.1\5.0.1\mingw47_32\bin\qmake.exe" exited normally.
23:49:46: Starting: "C:\Qt\Qt5.0.1\Tools\MinGW\bin\mingw32-make.exe" 
C:/Qt/Qt5.0.1/Tools/MinGW/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/backup/code/Qt-code/helloworld-console-build-Desktop_Qt_5_0_1_MinGW_32bit-Debug'
g++ -c -pipe -fno-keep-inline-dllexport -g 
-frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG 
-DQT_DECLARATIVE_DEBUG -I..\helloworld-console -I"." 
-I"..\..\..\..\Qt\Qt5.0.1\5.0.1\mingw47_32\mkspecs\win32-g++" -o 
debug\main.o ..\helloworld-console\main.cpp
g++.exe: error: ..helloworld-consolemain.cpp: No such file or directory
g++.exe: fatal error: no input files
compilation terminated.

Makefile.Debug:109: recipe for target 'debug/main.o' failed
mingw32-make[1]: *** [debug/main.o] Error 1
mingw32-make[1]: Leaving directory 'C:/backup/code/Qt-code/helloworld-console-build-Desktop_Qt_5_0_1_MinGW_32bit-Debug'
makefile:34: recipe for target 'debug' failed
mingw32-make: *** [debug] Error 2
23:49:47: The process "C:\Qt\Qt5.0.1\Tools\MinGW\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project helloworld-console (kit: Desktop Qt 5.0.1 MinGW 32bit)
When executing step 'Make'


After some fiddling around in Makefile.Debug I realized this solved the problem

Source code

1
2
3
4
changing 
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\main.o ..\helloworld-console\main.cpp
to       	
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/main.o ../helloworld-console/main.cpp


I created a GUI project and I had to change more things in the script
more examples of mistakes in the make script

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
wrong
C:\Qt\Qt5.0.1\5.0.1\mingw47_32\bin\moc.exe $(DEFINES) $(INCPATH) 
-D__GNUC__ -DWIN32 ..\hw3\mainwindow.h -o debug\moc_mainwindow.cpp
C:\Qt\Qt5.0.1\5.0.1\mingw47_32\bin\uic.exe ..\hw3\mainwindow.ui -o ui_mainwindow.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\main.o ..\hw3\main.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\mainwindow.o ..\hw3\mainwindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\moc_mainwindow.o debug\moc_mainwindow.cpp

correct
C:/Qt/Qt5.0.1/5.0.1/mingw47_32/bin/moc.exe $(DEFINES) $(INCPATH) 
-D__GNUC__ -DWIN32 ../hw3/mainwindow.h -o debug/moc_mainwindow.cpp
C:/Qt/Qt5.0.1/5.0.1/mingw47_32/bin/uic.exe ../hw3/mainwindow.ui -o ui_mainwindow.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/main.o ../hw3/main.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/mainwindow.o ../hw3/mainwindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug/moc_mainwindow.o debug/moc_mainwindow.cpp


My question is how can I report and fix this. Is it my problem or the code that generated the script?

This post has been edited 3 times, last edit by "noahfy" (Feb 6th 2013, 6:07am)


2

Sunday, March 3rd 2013, 2:29pm

error compiling, wrong slash used in Makefile.Debug [Workaround]

I've tracked down a workaround to the bug. Go into the following file (assuming the default isntallation path):
  • C:\Qt\Qt5.0.1\5.0.1\mingw47_32\mkspecs\win32-g++\qmake.conf

Roundabout line 98, you will see an isEmpty/else clause. If you move the QMAKE_DIR_SEP line to just before the clause, then the Makefiles will be built properly, using the forward slash the mingw tools want instead of the backward slash that's endemic to Win32.

Source code

1
2
3
4
5
6
7
8
QMAKE_DIR_SEP = /

!isEmpty(QMAKE_SH) {
    MINGW_IN_SHELL      = 1
    include(../common/shell-unix.conf)
} else {
    include(../common/shell-win32.conf)
}

Ideally, of course, this should be fixed in an update (anybody on the Qt team paying attention here?). But this will at least get you going so you don't have to constantly edit the Makefiles manaually.

3

Sunday, March 24th 2013, 11:49pm

Ideally, of course, this should be fixed in an update (anybody on the Qt team paying attention here?). But this will at least get you going so you don't have to constantly edit the Makefiles manaually.
@ghotihed: thank you very much, your fix saved me a lot of frustration.
Please, Qt team, fix this in the next release.
Thank you