天嵌 ARM开发社区

 找回密码
 注册
查看: 9765|回复: 27

在QT第一个程序,first程学,make不过去啊。求助。

[复制链接]
guoasd 发表于 2009-11-1 15:59:44 | 显示全部楼层 |阅读模式
本帖最后由 guoasd 于 2009-11-1 16:01 编辑

QT移植手册的中,在X86体系下编写第一个first程序。make时,编译不过去。出错如下图,我一共从头到尾按照手册做了三遍还是不行啊。苦恼啊。 对了,前一步,我的qpe编译已经通过,是在PClinux下可以模拟qtopia的, 这就说明我不缺东西吧。我觉得可能出错的地方,是我的first.cpp文件,我看我的first.cpp文件内容和QT手册上写的first.cpp内容有些不太一样。但是,这个first.cpp是自己生成的。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
xuehui869 发表于 2009-11-1 18:48:55 | 显示全部楼层
顶,和我的错的完全一样。照着PDF都会出错。。。。

应该是官方 提供的光盘里的程序有问题。。。。
arm-qtopia-2.2.0里面的能make过去,而x86里的不行。  我打开两者的Makefile,发现完全一样。。。。。。。。。。。。。。。官方没有把X86里面的程序打包好,咋会和arm里面的一样呢
回复

使用道具 举报

feathercx 发表于 2009-11-1 23:36:08 | 显示全部楼层
本帖最后由 feathercx 于 2009-11-1 23:37 编辑

看下你的makefile对不对  fisrst.cpp肯定要改下 编译后得到的.cpp需要自己改动下 说明槽函数响应的是什么动作
回复

使用道具 举报

xuehui869 发表于 2009-11-2 10:06:24 | 显示全部楼层
麻烦你把怎么改的,能说下吗.................前天才开始搞,请大侠帮忙
回复

使用道具 举报

rep_1984 发表于 2009-11-2 10:54:17 | 显示全部楼层
把你的Makefile 贴出来
回复

使用道具 举报

xuehui869 发表于 2009-11-2 11:05:27 | 显示全部楼层
这个makefile是按照PDF上的说明自动生成的:

#############################################################################
# Makefile for building first
# Generated by tmake at 17:37, 2009/11/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 \
                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 = $(QPEDIR)/bin/first
DESKTOP = $(QPEDIR)/apps/EmbedSky/first.desktop
ICON = $(QPEDIR)/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) $(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
回复

使用道具 举报

sunhy1021 发表于 2009-11-2 11:19:33 | 显示全部楼层
天嵌PDF上写的不是很清楚,按照上面做应该会有错误,我原来就是那样的。
它上面加了一个天嵌的logo图片,所有大家觉得有些不一样,按照上面的步骤是正确的,但是所添加的内容不要完全一样,根据自己的来就是!
回复

使用道具 举报

rep_1984 发表于 2009-11-2 11:24:58 | 显示全部楼层
本帖最后由 rep_1984 于 2009-11-2 11:28 编辑

first.o: first.cpp \
                first.h \
                first.ui
改为
first.o: first.cpp \
                first.h

好用与不好用都请回复
回复

使用道具 举报

xuehui869 发表于 2009-11-2 11:37:42 | 显示全部楼层
不对,make 后如下:

[root@EmbedSky first]# make
Makefile:126: warning: overriding commands for target `moc_first.cpp'
Makefile:123: warning: ignoring old commands for target `moc_first.cpp'
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/bin/uic first.ui -o ./first.h
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/bin/uic first.ui -i first.h -o first.cpp
###first.ui
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
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/bin/moc first.h -o moc_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 moc_first.o moc_first.cpp
g++  -o /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/bin/first first.o main.o first.o moc_first.o moc_first.o  -L/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/lib -L/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/lib -lqpe -lqtopia -lqte
g++: first.o: 没有那个文件或目录
g++: first.o: 没有那个文件或目录
make: *** [/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/bin/first] Error 1
[root@EmbedSky first]#
回复

使用道具 举报

xuehui869 发表于 2009-11-2 12:01:58 | 显示全部楼层
first的代码见
http://bbs.embedsky.net/viewthread.php?tid=1406&extra=
可下载,帮我看下。。。。谁有QT2.2.0下正确的程序麻烦传上来,或者发到我邮箱:xuehui869@163.com
回复

使用道具 举报

xuehui869 发表于 2009-11-2 12:44:35 | 显示全部楼层
哎,把makefile里面的冗余信息去掉就可以了,,,,,,,,
以后要把makefile好好看下
回复

使用道具 举报

0013180 发表于 2009-11-3 13:09:30 | 显示全部楼层
应该去掉那些冗余信息啊 我也是这个问题啊
回复

使用道具 举报

ddseven 发表于 2009-11-6 15:44:28 | 显示全部楼层
makefile 是自动生成,那哪些算是些冗余信息啊??
回复

使用道具 举报

xuehui869 发表于 2009-11-6 22:24:28 | 显示全部楼层
仔细看看  每个目标的依赖和规则,是不是有重复的地方; 目标也有重复的地方
回复

使用道具 举报

ddseven 发表于 2009-11-7 13:17:20 | 显示全部楼层
谢谢,现在过去了,但是在向ARM平台移植的时候,根据手册修改makefile后,出现如下错误,不知道何故?
-lqte
/opt/EmbedSky/crosstools_3.4.5_softfloat/gcc-3.4.5-glibc-2.3.6/arm-linux/lib/gcc/arm-linux/3.4.5/../../../../arm-linux/bin/ld: first.o: Relocations in generic ELF (EM: 3)
first.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

GMT+8, 2025-8-21 08:54 , Processed in 2.036047 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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