5
本帖最后由 zsagan 于 2012-6-13 18:20 编辑
[root@EmbedSky first]# make
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include -o first.o first.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include -o main.o main.cpp
main.cpp:3:36: qtopia/qpeapplicationl.h: 没有那个文件或目录
main.cpp:5: parse error before `)' token
main.cpp:6: ISO C++ forbids declaration of `QTOPIA_ADD_APPLICATION' with no
type
main.cpp:6: initializer list being treated as compound expression
main.cpp:6: syntax error at end of input
make: *** [main.o] Error 1
请问这是什么原因导致的,怎么解决呢
下面是开始自动生成的Makefile文件:
#############################################################################
# Makefile for building first
# Generated by tmake at 17:52, 2011/10/16
# Project: first
# 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 -I$(QPEDIR)/include
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L$(QPEDIR)/lib -L$(QTDIR)/lib -lqpe -lqtopia -lqte
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
TAR = tar -cf
GZIP = gzip -9f
####### Files
HEADERS = first.h
SOURCES = first.cpp \
main.cpp
OBJECTS = first.o \
main.o \
first.o
INTERFACES = first.ui
UICDECLS = first.h
UICIMPLS = first.cpp
SRCMOC = moc_first.cpp \
moc_first.cpp
OBJMOC = moc_first.o \
moc_first.o
DIST =
TARGET = first
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: first.pro
tmake first.pro -o Makefile
dist:
$(TAR) first.tar first.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
$(GZIP) first.tar
clean:
-rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
-rm -f *~ core
####### Sub-libraries
###### Combined headers
####### Compile
first.o: first.cpp \
first.h \
first.ui
main.o: main.cpp \
first.h \
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/qpeapplication.h
first.h: first.ui
$(UIC) first.ui -o $(INTERFACE_DECL_PATH)/first.h
first.cpp: first.ui
$(UIC) first.ui -i first.h -o first.cpp
first.o: first.cpp \
first.h \
first.ui
moc_first.o: moc_first.cpp \
first.h
moc_first.o: moc_first.cpp \
first.h
moc_first.cpp: first.h
$(MOC) first.h -o moc_first.cpp
moc_first.cpp: first.h
$(MOC) first.h -o moc_first.cpp
下面是修改之后的Makefile文件:做修改的地方用红色标出了已经
#############################################################################
# Makefile for building first
# Generated by tmake at 12:02, 2011/10/15
# Project: first
# 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 -I$(QPEDIR)/include
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L$(QPEDIR)/lib -L$(QTDIR)/lib -lqpe -lqtopia -lqte
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
TAR = tar -cf
GZIP = gzip -9f
####### Files
HEADERS = first.h
SOURCES = first.cpp \
main.cpp
OBJECTS = first.o \
main.o \
INTERFACES = first.ui
UICDECLS = first.h
UICIMPLS = first.cpp
SRCMOC = moc_first.cpp
OBJMOC = moc_first.o
DIST =
TARGET = $(QPEDIR)/image/opt/Qtopia/bin/first
DESKTOP= $(QPEDIR)/image/opt/Qtopia/apps/Embedsky/first.desktop
ICON= $(QPEDIR)/image/opt/Qtopia/pics/first.png
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)
cp -f first.desktop $(DESKTOP)
cp -f first.png $(ICON)
$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
moc: $(SRCMOC)
tmake: Makefile
Makefile: first.pro
tmake first.pro -o Makefile
dist:
$(TAR) first.tar first.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
$(GZIP) first.tar
clean:
-rm -f $(OBJECTS) $(OBJMOC) $(DESKTOP) $(ICON) $(TARGET)
-rm -f *~ core
####### Sub-libraries
###### Combined headers
####### Compile
first.o: first.cpp \
first.h \
first.ui
main.o: main.cpp \
first.h \
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/qpeapplication.h
first.h: first.ui
$(UIC) first.ui -o $(INTERFACE_DECL_PATH)/first.h
first.cpp: first.ui
$(UIC) first.ui -i first.h -o first.cpp
moc_first.o: moc_first.cpp \
first.h
moc_first.cpp: first.h
$(MOC) first.h -o moc_first.cpp
下面是一开始自动生成的first.cpp(没修改之前的):
/****************************************************************************
** Form implementation generated from reading ui file 'first.ui'
**
** Created: 鏃?10鏈?16 17:41:23 2011
** by: The User Interface Compiler ($Id: qt/main.cpp 3.1.1 edited Nov 21 17:40 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "first.h"
#include <qvariant.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a first as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
first::first( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "first" );
user_b = new QPushButton( this, "user_b" );
user_b->setGeometry( QRect( 120, 20, 111, 51 ) );
user_t = new QLabel( this, "user_t" );
user_t->setGeometry( QRect( 70, 90, 210, 50 ) );
QFont user_t_font( user_t->font() );
user_t_font.setPointSize( 18 );
user_t_font.setBold( TRUE );
user_t->setFont( user_t_font );
close = new QPushButton( this, "close" );
close->setGeometry( QRect( 240, 150, 90, 32 ) );
languageChange();
resize( QSize(600, 480).expandedTo(minimumSizeHint()) );
// signals and slots connections
connect( user_b, SIGNAL( clicked() ), this, SLOT( user_button() ) );
connect( close, SIGNAL( clicked() ), this, SLOT( close() ) );
}
/*
* Destroys the object and frees any allocated resources
*/
first::~first()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Sets the strings of the subwidgets using the current
* language.
*/
void first::languageChange()
{
setCaption( tr( "EmbedSky_First_QT_Program" ) );
user_b->setText( tr( "User Button" ) );
user_t->setText( QString::null );
close->setText( tr( "Close" ) );
}
void first::user_button()
{
qWarning( "first::user_button(): Not implemented yet" );
}
下面是修改之后的:
/****************************************************************************
** Form implementation generated from reading ui file 'first.ui'
**
** Created: 鏃?10鏈?16 18:34:11 2011
** by: The User Interface Compiler ($Id: qt/main.cpp 3.1.1 edited Nov 21 17:40 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "first.h"
#include <qvariant.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a first as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
first::first( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "first" );
user_b = new QPushButton( this, "user_b" );
user_b->setGeometry( QRect( 120, 20, 111, 51 ) );
user_t = new QLabel( this, "user_t" );
user_t->setGeometry( QRect( 70, 90, 210, 50 ) );
QFont user_t_font( user_t->font() );
user_t_font.setPointSize( 18 );
user_t_font.setBold( TRUE );
user_t->setFont( user_t_font );
close = new QPushButton( this, "close" );
close->setGeometry( QRect( 240, 150, 90, 32 ) );
languageChange();
resize( QSize(600, 480).expandedTo(minimumSizeHint()) );
// signals and slots connections
connect( user_b, SIGNAL( clicked() ), this, SLOT( user_button() ) );
connect( close, SIGNAL( clicked() ), this, SLOT( close() ) );
}
/*
* Destroys the object and frees any allocated resources
*/
first::~first()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Sets the strings of the subwidgets using the current
* language.
*/
void first::languageChange()
{
setCaption( tr( "EmbedSky_First_QT_Program" ) );
user_b->setText( tr( "User Button" ) );
user_t->setText( QString::null );
close->setText( tr( "Close" ) );
}
void first::user_button()
{
user_t->setText(tr("Hello,Qt Application!!"));
//qWarning( "first::user_button(): Not implemented yet" );
}
我来回答