cannot get makefile to work with Qt library
I have 3 files in my program: App_interface.h, App_interface.cpp, main.cpp. Im trying to compile my program which requires the Qt library. I just installed the Qt library in the default location. This is my makefile:
if your wondering why i don't use moc in this makefile is because 1) i dont know how to do that. 2) i just want to stop getting the compiler error "cannot find ... file".
thanks
# Project: App_interface
# 10-19-09
#
# general variables
CPP := g++
OBJS := main.o App_interface.o
# Qt directorys
QTLIB := /usr/local/Trolltech/Qt-4.5.3/lib
QTINC := /usr/local/Trolltech/Qt-4.5.3/include
QTMOC := /usr/local/Trolltech/Qt-4.5.3/bin
App_interfaceV1: $(OBJS)
$(CPP) $(OBJS) -o App_interfaceV1 $(QTLIB)
main.o: main.cpp App_interface.h
$(CPP) -B $(QTINC) -c开发者_JAVA技巧 main.cpp -o main.o
App_interface.o: App_interface.h
$(CPP) -B $(QTINC) -c App_interface.cpp -o App_interface.o
There are several problems: You should use -I $(QTINC)
to compile files, -L $(QTLIB)
and at least -lQtCore -lQtGui
to link the application. To get more help you should provide exact error messages.
Sorry to be blunt, but if you don't know how to write Makefile
s, I'd suggest to use qmake
.
精彩评论