Unable to include headers in Makefile
Hey everybody. Time for a newbie question =)
I keep bumbping in to an anoying problem all the time. When compiling I keep getting messages like
hello.cpp:2:19: qhbox,h: No such file or directory
Even though I have the file.
Now last I am trying to compile a QT program.
#include <qapplication.h>
#include <qhbox,h>
#include <qslider.h>
#include <qspinbox.h>
int main (int argc, char *argv[]) {
QApplication app (argc, argv);
QHBox *hbox = new QHBox (0);
hbox->setCaption ("Enter your age");
hbox->setMargin (6);
hbox->setSpacing (6);
QSpinBox *spinBox = new QSpinBox (hbox);
QSlider *slider = new QSlider (Qt::Horizontal, hbox);
spinBox->setRange (0,130);
slider->setRange(0,130);
QObject::connect(spinBox, SIGNAL(valueChanged(int)),
slider, SLOT(setValue(int)));
QObject::connect(slider, SIGNAL(valueChanged(int)),
spinBox, SLOT(setValue(int)));
spinBox->setValue(35);
app.setMainWidget(hbox);
hbox->show();
return app.exec();
}
With the following Makefile
#############################################################################
# Makefile for building: hello
# Generated by qmake (1.07a) (Qt 3.3.4) on: Fri Nov 4 08:24:46 2005
# Project: hello.pro
# Template: app
# Command: $(QMAKE) -o Makefile hello.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
LEX = flex
YACC = yacc
CFLAGS = -pipe -Wall -W -O2 -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT
CXXFLAGS = -pipe -Wall -W -O2 -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT
LEXFLAGS =
YACCFLAGS= -d
INCPATH = -I/usr/share/qt3/mkspecs/default -I. -I/usr/include/qt3 -I/usr/share/qt3/include
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L/usr/share/qt3/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
AR = ar cqs
RANLIB =
MOC = /usr/share/qt3/bin/moc
UIC = /usr/share/qt3/bin/uic
QMAKE = qmake
TAR = tar -cf
GZIP = gzip -9f
COPY = cp -f
COPY_FILE= $(COPY)
COPY_DIR = $(COPY) -r
INSTALL_FILE= $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
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
HEADERS =
SOURCES = hello.cpp
OBJECTS = hello.o
FORMS =
UICDECLS =
UICIMPLS =
SRCMOC =
OBJMOC =
DIST = hello.pro
QMAKE_TARGET = hello
DESTDIR =
TARGET = hello
first: all
####### Implicit rules
.SUFFIXES: .c .o .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): $(UICDECLS) $(OBJECTS) $(OBJMOC)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)
mocables: $(SRCMOC)
uicables: $(UICDECLS) $(UICIMPLS)
$(MOC):
( cd $(QTDIR)/src/moc && $(MAKE) )
Makefile: hello.pro /usr/share/qt3/mkspecs/default/qmake.conf /usr/share/qt3/lib/libqt-mt.prl
$(QMAKE) -o Makefile hello.pro
qmake:
@$(QMAKE) -o Makefile hello.pro
dist:
@mkdir -p .tmp/hello && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .tmp/hello/ && ( cd `dirname .tmp/hello` && $(TAR) hello.tar hello && $(GZIP) hello.tar ) && $(MOVE) `dirname .tmp/hello`/hello.tar.gz . && $(DEL_FILE) -r .tmp/hello
mocclean:
uiclean:
yaccclean:
lexclean:
clean:
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET) $(TARGET)
FORCE:
####### Compile
hello.o: hello.cpp
####### Install
install:
uninstall:
my qhbox,h file is at:
njohanss@sandiego:/usr/share/qt3/include$ ls qhbox.h
qhbox.h
Basiclly I have no clue how the Makefile works, I just tried to 'include' stuff here and there...
// Raphexion
|