[Solved] Can't compile project with makefile generated by qtmake
Hi. I'm trying to compile my project through the command line using the makefile that was generated by qtmake, and when g++ tries to compile the source code it says "no such file or directory", but the sources and project file are in the same folder!
Those are the steps I followed (all project and source files are in T:\QtTest):
T:\QtTest> qmake -project
And the output is:
mingw32-make -f Makefile.Debug
mingw32-make: Entering directory
T:/QtTest' g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\4.8.0\include\QtCore" -I"c:\Qt\4.8.0\include\QtGui" -I"c:\Qt\4.8.0\include" -I"." -I"c:\Qt\4.8.0\include\ActiveQt" -I"debug" -I"c:\Qt\4.8.0\mkspecs\default" -o debug\main.o main.cpp *g++: main.cpp: no such file or directory* g++: no input files mingw32-make: *** [debug/main.o] Error 1 mingw32-make: Leaving directoryT:/QtTest'
mingw32-make: *** [debug] Error 2
Why can't g++ find my source file, if all project and source files are together in the same folder?
Have you installed the gcc-c++ package?
sudo apt-get install g++
looks like this thread deals with the same error, hopefully it helps you solve your problem:
The qmake doc. is also useful for linking problems:
Thanks, my problem was being caused by the same reason as described in http://www.qtforum.org/article/25985/compiling-hello-world-after-fresh-install-fails.html. In fact I had an Autorun entry in the Windows registry so that CMD.EXE would startup in a custom working directory.
Removing that custom entry solved the problem.