谢谢楼上的同志。刚开始,问题太多,不知如何入手,尤其是照着书敲代码还出错。
例子是照着书上打的,怀疑是安装错了。
#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();
}
按照出错信息,打开makefile.debug
还是看不懂。
#############################################################################
# Makefile for building: test
# Generated by qmake (2.00a) (Qt 4.1.0) on: ??? ?? 3 22:00:51 2007
# Project: test.pro
# Template: app
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
LEX = flex
YACC = byacc
DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
CFLAGS = -g -g -Wall $(DEFINES)
CXXFLAGS = -g -g -frtti -fexceptions -Wall $(DEFINES)
LEXFLAGS =
YACCFLAGS = -d
INCPATH = -I"D:/Qt/4.1.0/include/QtCore" -I"D:/Qt/4.1.0/include/QtGui" -I"D:/Qt/4.1.0/include" -I"." -I"D:/Qt/4.1.0/include/ActiveQt" -I"debug" -I"." -I"D:/Qt/4.1.0/mkspecs/win32-g++"
LINK = g++
LFLAGS = -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,windows
LIBS = -L"D:\Qt\4.1.0\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
QMAKE = qmake
IDC = D:\Qt\4.1.0\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_DIR = $(COPY_DIR)
####### Output directory
OBJECTS_DIR = debug
####### Files
SOURCES = test.cpp
OBJECTS = debug\test.o
DIST =
QMAKE_TARGET = test
DESTDIR = debug\ #avoid trailing-slash linebreak
TARGET = test.exe
DESTDIR_TARGET = debug\test.exe
####### Implicit rules
.SUFFIXES: .c .cpp .cc .cxx
.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) -win32 -o Makefile.Debug test.pro
dist:
$(ZIP) test.zip $(SOURCES) $(DIST) test.pro D:/Qt/4.1.0/mkspecs/qconfig.pri ..\Qt\4.1.0\mkspecs\features\qt_config.prf ..\Qt\4.1.0\mkspecs\features\exclusive_builds.prf ..\Qt\4.1.0\mkspecs\features\default_pre.prf ..\Qt\4.1.0\mkspecs\features\win32\default_pre.prf ..\Qt\4.1.0\mkspecs\features\debug.prf ..\Qt\4.1.0\mkspecs\features\debug_and_release.prf ..\Qt\4.1.0\mkspecs\features\default_post.prf ..\Qt\4.1.0\mkspecs\features\build_pass.prf ..\Qt\4.1.0\mkspecs\features\Debug.prf ..\Qt\4.1.0\mkspecs\features\win32\rtti.prf ..\Qt\4.1.0\mkspecs\features\win32\exceptions.prf ..\Qt\4.1.0\mkspecs\features\win32\stl.prf ..\Qt\4.1.0\mkspecs\features\shared.prf ..\Qt\4.1.0\mkspecs\features\warn_on.prf ..\Qt\4.1.0\mkspecs\features\qt.prf ..\Qt\4.1.0\mkspecs\features\win32\thread.prf ..\Qt\4.1.0\mkspecs\features\moc.prf ..\Qt\4.1.0\mkspecs\features\win32\windows.prf ..\Qt\4.1.0\mkspecs\features\resources.prf ..\Qt\4.1.0\mkspecs\features\uic.prf D:\Qt\4.1.0\lib\qtmaind.prl HEADERS RESOURCES IMAGES SOURCES FORMS
clean: compiler_clean
-$(DEL_FILE) 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:
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
debug\test.o: test.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\test.o test.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE: