天嵌 ARM开发社区

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

编译问题,求大虾帮助 急都两天了,非常感谢

[复制链接]
zhangjianjie622 发表于 2010-8-19 20:11:50 | 显示全部楼层 |阅读模式
我的Makefile文件是这样的

####### 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

moc_first.o: moc_first.cpp \
                first.h

moc_first.cpp: first.h
        $(MOC) first.h -o moc_first.cpp



然后编译时出现下列错误
[root@EmbedSky first]# make
g++  -o 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
first.o: In function `first::user_button()':
first.cpp:(.text+0x0): multiple definition of `first::user_button()'
first.o:first.cpp:(.text+0x0): first defined here
first.o: In function `non-virtual thunk to first::~first()':
first.cpp:(.text+0x10): multiple definition of `non-virtual thunk to first::~first()'
first.o:first.cpp:(.text+0x10): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x20): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x20): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x40): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x40): first defined here
first.o: In function `non-virtual thunk to first::~first()':
first.cpp:(.text+0x60): multiple definition of `non-virtual thunk to first::~first()'
first.o:first.cpp:(.text+0x60): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x70): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x70): first defined here
first.o: In function `first::first(QWidget*, char const*, unsigned int)':
first.cpp:(.text+0xa0): multiple definition of `first::first(QWidget*, char const*, unsigned int)'
first.o:first.cpp:(.text+0xa0): first defined here
first.o: In function `first::first(QWidget*, char const*, unsigned int)':
first.cpp:(.text+0x330): multiple definition of `first::first(QWidget*, char const*, unsigned int)'
first.o:first.cpp:(.text+0x330): first defined here
moc_first.o: In function `first::className() const':
moc_first.cpp:(.text+0x0): multiple definition of `first::className() const'
moc_first.o:moc_first.cpp:(.text+0x0): first defined here
moc_first.o: In function `first::staticMetaObject()':
moc_first.cpp:(.text+0x40): multiple definition of `first::staticMetaObject()'
moc_first.o:moc_first.cpp:(.text+0x40): first defined here
moc_first.o:(.bss+0x0): multiple definition of `first::metaObj'
moc_first.o:(.bss+0x0): first defined here
moc_first.o: In function `first::tr(char const*, char const*)':
moc_first.cpp:(.text+0x100): multiple definition of `first::tr(char const*, char const*)'
moc_first.o:moc_first.cpp:(.text+0x100): first defined here
moc_first.o: In function `first::tr(char const*)':
moc_first.cpp:(.text+0x140): multiple definition of `first::tr(char const*)'
moc_first.o:moc_first.cpp:(.text+0x140): first defined here
moc_first.o: In function `first::initMetaObject()':
moc_first.cpp:(.text+0x180): multiple definition of `first::initMetaObject()'
moc_first.o:moc_first.cpp:(.text+0x180): first defined here
collect2: ld 返回 1
make: *** [first] 错误 1
Sasoritattoo 发表于 2010-8-19 20:22:08 | 显示全部楼层
你倒是挺爽快的,知道需要看Makefile文件,上来就贴Makefile文件!可是你咋也也不多说点儿,是PC平台还是ARM平台?源程序什么样的?
我看你这是在做Qtopia2.2.0的第一个实验吧.哈哈,我当年的试验也没成功。劝你趁早改行,做QT4.5
还是等其他大侠看看吧
时候不早了,继续干我的活
回复

使用道具 举报

shaxiaoziningyi 发表于 2010-8-19 20:30:05 | 显示全部楼层
哥们 开发文档你都没看清楚啊   

它告诉你makefile里面重复的东西要去掉  这个很重要    你仔细对照一下文档里给的makefile吧你就知道问题在哪了
回复

使用道具 举报

 楼主| zhangjianjie622 发表于 2010-8-21 00:36:59 | 显示全部楼层
非常感谢大侠回复。已解决
回复

使用道具 举报

qazasdwsx 发表于 2010-10-26 03:06:20 | 显示全部楼层
怎么解决的?
回复

使用道具 举报

guoxixiao 发表于 2010-12-31 00:34:36 | 显示全部楼层
细节决定成败
回复

使用道具 举报

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

本版积分规则

关闭

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

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

GMT+8, 2025-5-3 07:07 , Processed in 2.048424 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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