当前位置: 技术问答>linux和unix
为什么我的QT程序不能运行?(在线等!)
来源: 互联网 发布时间:2017-03-19
本文导语: 我的程序如下: #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton hello("hello QT!"); hello.resize(100,30); hello.show(); return app.exec(); } 编译过程:...
我的程序如下: #include
#include
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("hello QT!");
hello.resize(100,30);
hello.show();
return app.exec();
}
编译过程:qmake -project
qmake
make
我用的不是交叉编译,Makefile内容如下:#############################################################################
# Makefile for building: qt
# Generated by qmake (2.01a) (Qt 4.4.0-rc1) on: Sun Jan 4 10:27:27 2009
# Project: qt.pro
# Template: app
# Command: /usr/local/Trolltech/QtEmbedded-4.4.0-rc1/bin/qmake -unix -o Makefile qt.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/qws/linux-x86-g++ -I. -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include/QtCore -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include/QtCore -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include/QtNetwork -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include/QtNetwork -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include/QtGui -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include/QtGui -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include -I. -I. -I.
LINK = g++
LFLAGS = -Wl,-rpath,/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/lib
LIBS = $(SUBLIBS) -L/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/lib -lQtGui -L/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/lib -lpng -lfreetype -pthread -pthread -pthread -pthread -pthread -pthread -lQtNetwork -pthread -pthread -lQtCore -lz -lm -pthread -lgthread-2.0 -lglib-2.0 -lrt -ldl -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/local/Trolltech/QtEmbedded-4.4.0-rc1/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -R
INSTALL_FILE = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = $(COPY_FILE)
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 = 44.cpp
OBJECTS = 44.o
DIST = /usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/common/unix.conf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/qconfig.pri
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/qt_functions.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/qt_config.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/exclusive_builds.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/default_pre.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/release.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/default_post.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/warn_on.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/qt.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/unix/thread.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/moc.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/resources.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/uic.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/yacc.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/lex.prf
qt.pro
QMAKE_TARGET = qt
DESTDIR =
TARGET = qt
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$
#include
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("hello QT!");
hello.resize(100,30);
hello.show();
return app.exec();
}
编译过程:qmake -project
qmake
make
我用的不是交叉编译,Makefile内容如下:#############################################################################
# Makefile for building: qt
# Generated by qmake (2.01a) (Qt 4.4.0-rc1) on: Sun Jan 4 10:27:27 2009
# Project: qt.pro
# Template: app
# Command: /usr/local/Trolltech/QtEmbedded-4.4.0-rc1/bin/qmake -unix -o Makefile qt.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/qws/linux-x86-g++ -I. -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include/QtCore -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include/QtCore -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include/QtNetwork -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include/QtNetwork -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include/QtGui -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include/QtGui -I/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/include -I. -I. -I.
LINK = g++
LFLAGS = -Wl,-rpath,/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/lib
LIBS = $(SUBLIBS) -L/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/lib -lQtGui -L/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/lib -lpng -lfreetype -pthread -pthread -pthread -pthread -pthread -pthread -lQtNetwork -pthread -pthread -lQtCore -lz -lm -pthread -lgthread-2.0 -lglib-2.0 -lrt -ldl -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/local/Trolltech/QtEmbedded-4.4.0-rc1/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -R
INSTALL_FILE = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = $(COPY_FILE)
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 = 44.cpp
OBJECTS = 44.o
DIST = /usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/common/unix.conf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/qconfig.pri
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/qt_functions.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/qt_config.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/exclusive_builds.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/default_pre.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/release.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/default_post.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/warn_on.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/qt.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/unix/thread.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/moc.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/resources.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/uic.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/yacc.prf
/usr/local/Trolltech/QtEmbedded-4.4.0-rc1/mkspecs/features/lex.prf
qt.pro
QMAKE_TARGET = qt
DESTDIR =
TARGET = qt
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$