天嵌 ARM开发社区

 找回密码
 注册
查看: 1850|回复: 2

根据手册执行第一个Qt时出现问题

[复制链接]
刘志华 发表于 2012-3-22 21:41:11 | 显示全部楼层 |阅读模式
[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
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/image/opt/Qtopia/bin/first first.o main.o 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 `non-virtual thunk to first::~first()':
first.cpp:(.text+0x0): multiple definition of `non-virtual thunk to first::~first()'
first.o:first.cpp:(.text+0x0): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x10): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x10): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x30): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x30): first defined here
first.o: In function `non-virtual thunk to first::~first()':
first.cpp:(.text+0x50): multiple definition of `non-virtual thunk to first::~first()'
first.o:first.cpp:(.text+0x50): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x60): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x60): first defined here
first.o: In function `first::user_button()':
first.cpp:(.text+0x90): multiple definition of `first::user_button()'
first.o:first.cpp:(.text+0x90): first defined here
first.o: In function `first::first(QWidget*, char const*, unsigned int)':
first.cpp:(.text+0x110): multiple definition of `first::first(QWidget*, char const*, unsigned int)'
first.o:first.cpp:(.text+0x110): first defined here
first.o: In function `first::first(QWidget*, char const*, unsigned int)':
first.cpp:(.text+0x460): multiple definition of `first::first(QWidget*, char const*, unsigned int)'
first.o:first.cpp:(.text+0x460): first defined here
collect2: ld returned 1 exit status
make: *** [/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/bin/first] Error 1
 楼主| 刘志华 发表于 2012-3-22 21:46:12 | 显示全部楼层
原来是Makefile文件中有重复的信息,已经解决了!!
半棵苗 发表于 2012-8-30 17:29:29 | 显示全部楼层
本帖最后由 半棵苗 于 2012-8-30 17:29 编辑

谢了,我的也是同样的问题。当时没有仔细查重,漏了几个地方,
以下是我的Makefile

#############################################################################
# Makefile for building first
# Generated by tmake at 16:18, 2012/08/30
#     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)/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)
first.o: moc_first.cpp \


$(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)
#$(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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

GMT+8, 2024-5-29 18:09 , Processed in 1.046875 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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