error int the first proggrame
sorry,i have no Chinise input software.I din't known why this error occues.
Need help!
Thanks all the firends~:)
Te message as below:
# ls
first.cpp first.hfirst.pngfirst.uiMakefile my_makefile
first.desktopfirst.ofirst.promain.cppmoc_first.cppui2cpp
# make clean
rm -f first.o main.omoc_first.o/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/bin/first
rm -f *~ core
# ls
first.cppfirst.desktopfirst.hfirst.pngfirst.profirst.uimain.cppMakefilemoc_first.cppmy_makefileui2cpp
# 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: In function ‘QWidget* create_first(QWidget*, const char*, uint)’:
main.cpp:5: error: expected type-specifier before ‘first’
main.cpp:5: error: cannot convert ‘int*’ to ‘QWidget*’ in return
main.cpp:5: error: expected ‘;’ before ‘first’
main.cpp:5: error: ‘first’ was not declared in this scope
make: *** Error 1
# cat main.cpp
#include "first.h"
#include <qapplication.h>
#include <qtopia/qpeapplication.h>
QTOPIA_ADD_APPLICATION("first",first)
QTOPIA_MAIN
#
now ,this is my Makefile, i think it is right~
#############################################################################
# Makefile for building first
# Generated by tmake at 07:08, 2010/10/01
# 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) $(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
nobody knowns? Sorry!I do not know! 2# yixiaoyang
main.cpp: In function ‘QWidget* create_first(QWidget*, const char*, uint)’:
main.cpp:5: error: expected type-specifier before ‘first’
main.cpp:5: error: cannot convert ‘int*’ to ‘QWidget*’ in return
main.cpp:5: error: expected ‘;’ before ‘first’
main.cpp:5: error: ‘first’ was not declared in this scope
Great guy, the compiler already throwed the error messageas above.
Better you past your source code for us . 你的first.cpp中setName("first")是这样的吗?如果不是改过来就可以了。 楼主 后面怎么调试通过的 现在我也遇到这个问题 了求解啊
页:
[1]