PDA

View Full Version : No rule to make target



Coolname007
3rd March 2011, 18:07
Hello,
when I try to compile my Qt project through the use of Qt Creator's Run button, I receive an 'No rule to make target' error from mingw32-make[1]. The target is a C++ header file that I did include in the project, so I don't know why I'm getting this error.

Also note that my Qt project is in a different partition than Qt, if that makes a difference. The reason I think it might is because I did a Google search, and found this thread (http://www.qtcentre.org/threads/35799-building-for-symbian-device-error-No-rule-to-make-target-MAKEFILE_0XE587C205.MK).

Here is the complete compile output:


E:/Qt/2009.03/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `D:/Documents and Settings/Coolname007/My Documents/Programming_Projects/MAW/Modules/WebCoder_mod/modules/C_html_coder/C_html4_coder/module/C_html4_elements/modules/C_html4_tags/modules/C_html4_attributes'
mingw32-make[1]: Leaving directory `D:/Documents and Settings/Coolname007/My Documents/Programming_Projects/MAW/Modules/WebCoder_mod/modules/C_html_coder/C_html4_coder/module/C_html4_elements/modules/C_html4_tags/modules/C_html4_attributes'
mingw32-make[1]: *** No rule to make target `../../../C_html_element/modules/S_html_attr/S_html_attr.h', needed by `debug/C_html4_attributes.o'. Stop.
mingw32-make: Leaving directory `D:/Documents and Settings/Coolname007/My Documents/Programming_Projects/MAW/Modules/WebCoder_mod/modules/C_html_coder/C_html4_coder/module/C_html4_elements/modules/C_html4_tags/modules/C_html4_attributes'
mingw32-make: *** [debug] Error 2
Exited with code 2.
Error while building project C_html4_attributes
When executing build step 'Make'

Here is my Makefile.Debug:


################################################## ###########################
# Makefile for building: C_html4_attributes
# Generated by qmake (2.01a) (Qt 4.5.2) on: Thu Mar 3 09:55:14 2011
# Project: C_html4_attributes.pro
# Template: app
################################################## ###########################

####### Compiler, tools and options

CC = gcc
CXX = g++
DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
CFLAGS = -g -Wall $(DEFINES)
CXXFLAGS = -g -frtti -fexceptions -mthreads -Wall $(DEFINES)
INCPATH = -I"e:\Qt\2009.03\qt\include\QtCore" -I"e:\Qt\2009.03\qt\include\QtGui" -I"e:\Qt\2009.03\qt\include" -I"e:\Qt\2009.03\qt\include\ActiveQt" -I"debug" -I"e:\Qt\2009.03\qt\mkspecs\win32-g++"
LINK = g++
LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows
LIBS = -L"e:\Qt\2009.03\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
QMAKE = e:\Qt\2009.03\qt\bin\qmake.exe
IDC = e:\Qt\2009.03\qt\bin\idc.exe
IDL = midl
ZIP = zip -r -9
DEF_FILE =
RES_FILE =
COPY = copy /y
COPY_FILE = $(COPY)
COPY_DIR = xcopy /s /q /y /i
DEL_FILE = del
DEL_DIR = rmdir
MOVE = move
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
INSTALL_FILE = $(COPY_FILE)
INSTALL_PROGRAM = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)

####### Output directory

OBJECTS_DIR = debug

####### Files

SOURCES = C_html4_attributes.cpp \
test.cpp
OBJECTS = debug/C_html4_attributes.o \
debug/test.o
DIST =
QMAKE_TARGET = C_html4_attributes
DESTDIR = debug\ #avoid trailing-slash linebreak
TARGET = C_html4_attributes.exe
DESTDIR_TARGET = debug\C_html4_attributes.exe

####### Implicit rules

.SUFFIXES: .cpp .cc .cxx .c

.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<

####### Build rules

first: all
all: Makefile.Debug $(DESTDIR_TARGET)

$(DESTDIR_TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(DESTDIR_TARGET) $(OBJECTS) $(LIBS)


qmake: FORCE
@$(QMAKE) -spec e:\Qt\2009.03\qt\mkspecs\win32-g++ -win32 -o Makefile.Debug C_html4_attributes.pro

dist:
$(ZIP) C_html4_attributes.zip $(SOURCES) $(DIST) C_html4_attributes.pro e:\Qt\2009.03\qt\mkspecs\qconfig.pri e:\Qt\2009.03\qt\mkspecs\features\qt_functions.prf e:\Qt\2009.03\qt\mkspecs\features\qt_config.prf e:\Qt\2009.03\qt\mkspecs\features\exclusive_builds .prf e:\Qt\2009.03\qt\mkspecs\features\default_pre.prf e:\Qt\2009.03\qt\mkspecs\features\win32\default_pr e.prf e:\Qt\2009.03\qt\mkspecs\features\debug.prf e:\Qt\2009.03\qt\mkspecs\features\debug_and_releas e.prf e:\Qt\2009.03\qt\mkspecs\features\default_post.prf e:\Qt\2009.03\qt\mkspecs\features\win32\default_po st.prf e:\Qt\2009.03\qt\mkspecs\features\build_pass.prf e:\Qt\2009.03\qt\mkspecs\features\win32\rtti.prf e:\Qt\2009.03\qt\mkspecs\features\win32\exceptions .prf e:\Qt\2009.03\qt\mkspecs\features\win32\stl.prf e:\Qt\2009.03\qt\mkspecs\features\shared.prf e:\Qt\2009.03\qt\mkspecs\features\warn_on.prf e:\Qt\2009.03\qt\mkspecs\features\qt.prf e:\Qt\2009.03\qt\mkspecs\features\win32\thread.prf e:\Qt\2009.03\qt\mkspecs\features\moc.prf e:\Qt\2009.03\qt\mkspecs\features\win32\windows.pr f e:\Qt\2009.03\qt\mkspecs\features\resources.prf e:\Qt\2009.03\qt\mkspecs\features\uic.prf e:\Qt\2009.03\qt\mkspecs\features\yacc.prf e:\Qt\2009.03\qt\mkspecs\features\lex.prf e:\Qt\2009.03\qt\mkspecs\features\include_source_d ir.prf e:\Qt\2009.03\qt\lib\qtmaind.prl HEADERS RESOURCES IMAGES SOURCES OBJECTIVE_SOURCES FORMS YACCSOURCES YACCSOURCES LEXSOURCES

clean: compiler_clean
-$(DEL_FILE) debug\C_html4_attributes.o debug\test.o

distclean: clean
-$(DEL_FILE) $(DESTDIR_TARGET)
-$(DEL_FILE) Makefile.Debug

mocclean: compiler_moc_header_clean compiler_moc_source_clean

mocables: compiler_moc_header_make_all compiler_moc_source_make_all

compiler_moc_header_make_all:
compiler_moc_header_clean:
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean:



####### Compile

debug/C_html4_attributes.o: C_html4_attributes.cpp C_html4_attributes.h \
C_ENUM_attr_to_strings.h \
../../../C_html_element/modules/S_html_attr/S_html_attr.h \
../../../S_class_functions_info/S_class_functions_info.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\C_html4_attributes.o C_html4_attributes.cpp

debug/test.o: test.cpp C_html4_attributes.h \
C_ENUM_attr_to_strings.h \
../../../C_html_element/modules/S_html_attr/S_html_attr.h \
../../../S_class_functions_info/S_class_functions_info.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\test.o test.cpp

####### Install

install: FORCE

uninstall: FORCE

FORCE:



If you need any more info, just ask...

Thanks in advance to anyone who tries to help.

arnaiz
3rd March 2011, 20:17
Coolname007

Make can't find that header file. That's why it looks for a rule to create it. Of course there is no such a rule. You have to show us the proyect file, and the source file including S_html_attr.h

Coolname007
3rd March 2011, 22:02
Coolname007

Make can't find that header file. That's why it looks for a rule to create it. Of course there is no such a rule. You have to show us the proyect file, and the source file including S_html_attr.h
Well, obviously...
What's weird about that is that I included the header file in said project, so make should have no problem finding it.

I attached the project file only.Take my word on it that the source file including S_html_attr.h (i.e. C_html4_attributes.cpp, though technically, the header file C_html4_attributes.h includes it, and C_html4_attributes.cpp includes that) is included in the project as well.

Thanks.

Added after 1 10 minutes:



Also note that my Qt project is in a different partition than Qt, if that makes a difference. The reason I think it might is because I did a Google search, and found this thread (http://www.qtcentre.org/threads/35799-building-for-symbian-device-error-No-rule-to-make-target-MAKEFILE_0XE587C205.MK).

Yeah, that was the problem. I copied my project directory over to the same partition as Qt, then loaded the copied project into Qt Creator, and attempted to compile again, and now its past that error.

Anyone know why Qt has this behavior? Why wont it work with the project on a different partition than Qt?

ChrisW67
3rd March 2011, 23:30
Anyone know why Qt has this behavior? Why wont it work with the project on a different partition than Qt?

It doesn't. It will... I do it all the time.

The compiler cannot find your include file. If you:


#include "somerandom.h"

the compiler will search the directory containing the including file and then along its include search path. If you:


#include <somerandom.h>

the compiler will search only its search path. The compiler has a default search path that can generally be adjusted with command line options. None of this has anything to do with Qt and the specifics vary from compiler to compiler.

Qt project files can adjust the include (and library) search paths for you in a compiler and platform independent way. The path the compiler uses to search for include files is adjusted, oddly enough, with a variable called INCLUDEPATH in the PRO file. For MingW and GCC qmake translates it into the INCPATH variable in the Makefile. In your Makefile above you will see only Qt, GCC, and the target directory paths in the include path... none of your source directories.

Listing a header FILE in the HEADERS variable, which I expect is what you have done, tells Qt it needs to scan the file for Qt extensions like signals or slots... it does not adjust the INCLUDEPATH.

Coolname007
4th March 2011, 00:08
It doesn't. It will... I do it all the time.

The compiler cannot find your include file. If you:


#include "somerandom.h"

the compiler will search the directory containing the including file and then along its include search path. If you:


#include <somerandom.h>

the compiler will search only its search path. The compiler has a default search path that can generally be adjusted with command line options. None of this has anything to do with Qt and the specifics vary from compiler to compiler.

Qt project files can adjust the include (and library) search paths for you in a compiler and platform independent way. The path the compiler uses to search for include files is adjusted, oddly enough, with a variable called INCLUDEPATH in the PRO file. For MingW and GCC qmake translates it into the INCPATH variable in the Makefile. In your Makefile above you will see only Qt, GCC, and the target directory paths in the include path... none of your source directories.

Listing a header FILE in the HEADERS variable, which I expect is what you have done, tells Qt it needs to scan the file for Qt extensions like signals or slots... it does not adjust the INCLUDEPATH.
Well, I was using an #include line that looks like this:


#include "../../../C_html_element/modules/S_html_attr/S_html_attr.h"
and I know for a fact the file "S_html_attr.h" exists at that location, relative to the directory of C_html4_attributes.h. But it produced the above error anyway. Copying the project directory over to the same partition as Qt, and compiling the copied project does not produce this error. That tells me this must be a Qt Windows specific error. Note that I compiled the same project in my other OS (Ubuntu; I have a multiboot) with Qt Creator on the same computer, and it did not produce that error.
Also note that I was using the generated Makefile.Debug, which I did not modify in any way. So I did not attempt to do anything with the HEADERS variable, though I did notice that the makefile had a SOURCES variable which listed all the sources of my project, but it did not have a HEADERS variable. The makefile above is what I was using.

arnaiz
4th March 2011, 16:21
Coolname007:

The original error "no rule to make target..." came from make, in your case mingw32-make. It was not Qt who signal that error nor the compiler. Your header file could not be reached by make, so it try to find a rule to make it, and obviously that rule didn't exist. You have to check your paths to the header file or there is a problem with make (mingw32-make). I think it's more probable that you make a mistake...

Coolname007
4th March 2011, 21:08
Coolname007:

The original error "no rule to make target..." came from make, in your case mingw32-make. It was not Qt who signal that error nor the compiler. Your header file could not be reached by make, so it try to find a rule to make it, and obviously that rule didn't exist. You have to check your paths to the header file or there is a problem with make (mingw32-make). I think it's more probable that you make a mistake...
I wasn't saying it was Qt that was signaling the error. Obviously, that error came from make. What I was saying was, Qt Creator must be the one that caused it (or at least in the sense that it does not allow the project directory to be in another partition than Qt), because when you build or run a project through Qt Creator, you're not dealing with make directly. Instead Qt Creator deals with it for you.
In regards, to checking my paths: I have already done so, and am 100% sure that they are correct, and like already mentioned, copying the project directory to the same partition as Qt, and then attempting to build the copied project through Qt Creator (WITHOUT modifying anything else) no longer produced that error. So that tells me it must be a limitation in Qt Creator.

Now if you know otherwise, feel free to post about it. ;)