天嵌 ARM开发社区

 找回密码
 注册
查看: 1935|回复: 5

error in the first proggrame

[复制链接]
yixiaoyang 发表于 2010-10-1 09:31:50 | 显示全部楼层 |阅读模式
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:


[root@yixiaoyang first]# ls
first.cpp      first.h  first.png  first.ui  Makefile       my_makefile
first.desktop  first.o  first.pro  main.cpp  moc_first.cpp  ui2cpp
[root@yixiaoyang first]# make clean
rm -f first.o main.o  moc_first.o  /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/bin/first
rm -f *~ core
[root@yixiaoyang first]# ls
first.cpp  first.desktop  first.h  first.png  first.pro  first.ui  main.cpp  Makefile  moc_first.cpp  my_makefile  ui2cpp
[root@yixiaoyang 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: 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: *** [main.o] Error 1
[root@yixiaoyang first]# cat main.cpp
#include "first.h"
#include <qapplication.h>
#include <qtopia/qpeapplication.h>

QTOPIA_ADD_APPLICATION("first",first)
QTOPIA_MAIN
[root@yixiaoyang first]#

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



 楼主| yixiaoyang 发表于 2010-10-1 12:54:10 | 显示全部楼层
nobody knowns?
kelvinjie 发表于 2010-10-2 09:58:40 | 显示全部楼层
Sorry!I do not know!
天嵌_support1 发表于 2010-10-7 16:04:31 | 显示全部楼层
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 message  as above.
Better you past your source code for us .
glqinhan 发表于 2010-11-22 10:57:06 | 显示全部楼层
你的first.cpp中setName("first")是这样的吗?如果不是改过来就可以了。
jxhui23 发表于 2012-9-14 21:28:17 | 显示全部楼层
楼主 后面怎么调试通过的 现在我也遇到这个问题 了  求解啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2024-11-1 07:06 , Processed in 1.062500 second(s), 18 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表