qt编程问题
hello.cpp程序如下:
#include <qapplication.h>
#include <qlabel.h>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello, Qt!", 0);
label->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
label->setGeometry(10, 10, 200, 80);
app.setMainWidget(label);
label->show();
int result = app.exec();
return result;
}
make的错误如下:
[root@localhost hell]# make
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/utuLinux2.6.24/qtopia-1.7-tp/qt-2.3.2/include -o hello.o hello.cpp
gcc -o hello hello.o -L/utuLinux2.6.24/qtopia-1.7-tp/qt-2.3.2/lib -lqte
/usr/bin/ld: cannot find -lqte
collect2: ld returned 1 exit status
make: *** [hello] Error 1
我想用Qt-x11来完成编译。
环境变量设的是:#!/bin/bash
export ThirdPartyLibDIR=$PWD/3rdparty/lib
export ThirdPartyIncludeDIR=$PWD/3rdparty/include
export QTDIR=$PWD/qt-2.3.2
export QPEDIR=$PWD/qt-embedded-2.3.7
export TMAKEDIR=$PWD/tmake-1.11
export TMAKEPATH=$TMAKEDIR/lib/qws/linux-x86-g++
export PATH=$QTDIR/binQPEDIR/binTMAKEDIR/binPATH
用tmake产生的Makefile文件如下:
#############################################################################
# Makefile for building hello
# Generated by tmake at 10:14, 2010/11/12
# Project: hello
# Template: app
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
CFLAGS = -pipe -Wall -W -O2 -DNO_DEBUG
CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG
INCPATH = -I$(QTDIR)/include
LINK = gcc
LFLAGS =
LIBS = $(SUBLIBS) -L$(QTDIR)/lib -lqte
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
TAR = tar -cf
GZIP = gzip -9f
####### Files
HEADERS =
SOURCES = hello.cpp
OBJECTS = hello.o
INTERFACES =
UICDECLS =
UICIMPLS =
SRCMOC =
OBJMOC =
DIST =
TARGET = hello
INTERFACE_DECL_PATH = .
####### Implicit rules
.SUFFIXES: .cpp .cxx .cc .C .c
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
####### Build rules
all: $(TARGET)
$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
moc: $(SRCMOC)
tmake: Makefile
Makefile: hello.pro
tmake hello.pro -o Makefile
dist:
$(TAR) hello.tar hello.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
$(GZIP) hello.tar
clean:
-rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
-rm -f *~ core
####### Sub-libraries
###### Combined headers
####### Compile
hello.o: hello.cpp
我看makefile文件的lib怎么会是lqte,我没想用到qte的库啊。。。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论