Results 1 to 4 of 4
Hey everyone,
I am running Ubuntu feisty and have got the following packages installed using synaptic:
libqt3-headers, libqt3-mt, libqt3-mt-dev, libqt4-core, libqt4-dev, libqt4-gui, libqt4-qt3support, libqt4-sql, qt3-dev-tools, qt4-dev-tools
I am trying to ...
- 04-28-2007 #1Just Joined!
- Join Date
- Apr 2006
- Posts
- 30
Problem running QT4 hello world...
Hey everyone,
I am running Ubuntu feisty and have got the following packages installed using synaptic:
libqt3-headers, libqt3-mt, libqt3-mt-dev, libqt4-core, libqt4-dev, libqt4-gui, libqt4-qt3support, libqt4-sql, qt3-dev-tools, qt4-dev-tools
I am trying to compile and run the hello world example in qt described here: http://doc.trolltech.com/4.2/tutorial-t1.html
I followed the following steps:
1- qmake-qt4 -project
2- qmake-qt4 HelloWorld.project
The makefile and project file were successfully generated...
3- make
I get the following error:
make: *** No rule to make target `Hello', needed by `Makefile'. Stop.
Note: if I change qmake-qt4 with qmake I get the error in making that QApplication include does not exist...
This is HelloWorld.cpp:
#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello World!");
label->show();
return app.exec();
}
This is Hello World.project:
################################################## ####################
# Automatically generated by qmake (2.01a) Sat Apr 28 21:38:34 2007
################################################## ####################
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
SOURCES += helloWorld.cpp
This is Makefile:
################################################## ###########################
# Makefile for building: Hello\ World
# Generated by qmake (2.01a) (Qt 4.2.3) on: Sat Apr 28 21:50:01 2007
# Project: Hello World.pro
# Template: app
# Command: /usr/bin/qmake-qt4 -unix -o Makefile Hello\ World.pro
################################################## ###########################
####### Compiler, tools and options
CC = gcc
CXX = g++
LEX = flex
YACC = yacc
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
LEXFLAGS =
YACCFLAGS = -d
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I.
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L/usr/lib -lQtGui -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake-qt4
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = helloWorld.cpp
OBJECTS = helloWorld.o
DIST = /usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/release.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
Hello World.pro
QMAKE_TARGET = Hello\ World
DESTDIR =
TARGET = Hello\ World
first: all
####### Implicit rules
.SUFFIXES: .o .c .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:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
####### Build rules
all: Makefile $(TARGET)
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: Hello World.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/release.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf
$(QMAKE) -unix -o Makefile Hello\ World.pro
/usr/share/qt4/mkspecs/common/unix.conf:
/usr/share/qt4/mkspecs/common/g++.conf:
/usr/share/qt4/mkspecs/common/linux.conf:
/usr/share/qt4/mkspecs/qconfig.pri:
/usr/share/qt4/mkspecs/features/qt_functions.prf:
/usr/share/qt4/mkspecs/features/qt_config.prf:
/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
/usr/share/qt4/mkspecs/features/default_pre.prf:
/usr/share/qt4/mkspecs/features/release.prf:
/usr/share/qt4/mkspecs/features/default_post.prf:
/usr/share/qt4/mkspecs/features/warn_on.prf:
/usr/share/qt4/mkspecs/features/qt.prf:
/usr/share/qt4/mkspecs/features/unix/thread.prf:
/usr/share/qt4/mkspecs/features/moc.prf:
/usr/share/qt4/mkspecs/features/resources.prf:
/usr/share/qt4/mkspecs/features/uic.prf:
qmake: FORCE
@$(QMAKE) -unix -o Makefile Hello\ World.pro
dist:
@$(CHK_DIR_EXISTS) .tmp/Hello\ World1.0.0 || $(MKDIR) .tmp/Hello\ World1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/Hello World1.0.0/ && $(COPY_FILE) --parents helloWorld.cpp .tmp/Hello World1.0.0/ && (cd `dirname .tmp/Hello World1.0.0` && $(TAR) Hello\ World1.0.0.tar Hello\ World1.0.0 && $(COMPRESS) Hello\ World1.0.0.tar) && $(MOVE) `dirname .tmp/Hello World1.0.0`/Hello\ World1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/Hello World1.0.0
yaccclean:
lexclean:
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
/usr/bin/moc-qt4:
(cd $(QTDIR)/src/tools/moc && $(MAKE))
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_clean: compiler_moc_header_clean compiler_rcc_clean compiler_image_collection_clean compiler_moc_source_clean compiler_uic_clean
####### Compile
helloWorld.o: helloWorld.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o helloWorld.o helloWorld.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
-------------------------------------------------
Please help me resolve this issue...
Thank you
- 04-28-2007 #2Just Joined!
- Join Date
- Apr 2006
- Posts
- 30
Terribly sorry stupid mistake...
Sorry everyone, the folder name should have contained no spaces...
Terribly sorry
- 04-28-2007 #3Linux User
- Join Date
- Oct 2004
- Location
- /dev/random
- Posts
- 404
The problem is likely caused by the space in the name "Hello World".
Try with some other name for the project like "Hello_World" or "HW" or something like that without a space.
The logic is when the make program tries to build the default target ("first", in your case), it sees that it depends on another target called "all". Then it tries to build "all", which takes it to a dependency "Makefile Hello\ World" ("Hello\ World" is part of $(TARGET)). This dependency when expanded will become "Makefile Hello World", so make will see this as 3 dependencies - Makefile, Hello and World. However, the Makefile doesn't have any target to build Hello (or World, for that matter), so make cannot satisfy the dependency and it croaks.The Unforgiven
Registered Linux User #358564
- 04-28-2007 #4Just Joined!
- Join Date
- Apr 2006
- Posts
- 30
Thanks alot, you are totally correct!


Reply With Quote