交叉编译完qte2.3.7,写了个test程序,里面调用了ACE库
#include <qapplication.h>
#include <qpushbutton.h>
#include <ace/OS.h>
int main(int argc, char **argv)
{
QApplication a(argc, argv);
QPushButton hello("hello,world", 0);
hello.resize(100, 30);
char title[32];
ACE_OS::sprintf(title,"你好");
hello.setText(QString::fromUtf8(title));
a.setMainWidget(&hello);
hello.show();
return a.exec();
}
运行make时出现以下错误
[root@localhost test]# make
arm-linux-g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/qt/qte/include -I/opt/ace/ACE_wrappers -o test.o test.cpp
In file included from /opt/qt/qte/include/qwindowdefs.h:44,
from /opt/qt/qte/include/qwidget.h:42,
from /opt/qt/qte/include/qapplication.h:42,
from test.cpp:1:
/opt/qt/qte/include/qstring.h: In member function `uchar& QChar::cell()':
/opt/qt/qte/include/qstring.h:166: error: cannot bind packed field `((QChar*)this)->QChar::cl' to `uchar&'
/opt/qt/qte/include/qstring.h: In member function `uchar& QChar::row()':
/opt/qt/qte/include/qstring.h:167: error: cannot bind packed field `((QChar*)this)->QChar::rw' to `uchar&'
make: *** [test.o] Error 1
[root@localhost test]#
Makefile文件:
[root@localhost test]# cat Makefile
#############################################################################
# Makefile for building test
# Generated by tmake at 20:02, 2009/04/21
# Project: test
# Template: app
#############################################################################
####### Compiler, tools and options
CC = arm-linux-gcc
CXX = arm-linux-g++
CFLAGS = -pipe -Wall -W -O2 -DNO_DEBUG
CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG
INCPATH = -I$(QTDIR)/include -I/opt/ace/ACE_wrappers
LINK = arm-linux-gcc
LFLAGS =
LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/opt/ace/ACE_wrappers/lib -lm -lqte -lACE
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
TAR = tar -cf
GZIP = gzip -9f
####### Files
HEADERS =
SOURCES = test.cpp
OBJECTS = test.o
INTERFACES =
UICDECLS =
UICIMPLS =
SRCMOC =
OBJMOC =
DIST =
TARGET = test
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: test.pro
tmake test.pro -o Makefile
dist:
$(TAR) test.tar test.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
$(GZIP) test.tar
clean:
-rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
-rm -f *~ core
####### Sub-libraries
###### Combined headers
####### Compile
test.o: test.cpp
[ 此帖被oyhuan在2009-04-22 08:49重新编辑 ]