求助:编译安装GCC4.5.0后出现的奇怪问题

编译打包和其他
回复
ldg2050
帖子: 34
注册时间: 2010-05-15 2:05

求助:编译安装GCC4.5.0后出现的奇怪问题

#1

帖子 ldg2050 » 2010-05-22 2:29

gcy@cy-desktop:~/桌面$ g++45 -o hello.out helloword.o
helloword.o: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/crt1.o:(.text+0x0): first defined here
helloword.o:(.rodata+0x0): multiple definition of `_fp_hw'
/usr/lib/crt1.o:(.rodata+0x0): first defined here
helloword.o: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/crti.o:(.fini+0x0): first defined here
helloword.o:(.rodata+0x4): multiple definition of `_IO_stdin_used'
/usr/lib/crt1.o:(.rodata.cst4+0x0): first defined here
helloword.o: In function `__data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/crt1.o:(.data+0x0): first defined here
helloword.o: In function `__data_start':
(.data+0x4): multiple definition of `__dso_handle'
/usr/local/gcc-4.5.0/lib/gcc/i686-pc-linux-gnu/4.5.0/crtbegin.o:(.data+0x0): first defined here
helloword.o: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/crti.o:(.init+0x0): first defined here
/usr/local/gcc-4.5.0/lib/gcc/i686-pc-linux-gnu/4.5.0/crtend.o:(.dtors+0x0): multiple definition of `__DTOR_END__'
helloword.o:(.dtors+0x4): first defined here
/usr/bin/ld: warning: Cannot create .eh_frame_hdr section, --eh-frame-hdr ignored.
/usr/bin/ld: error in helloword.o(.eh_frame); no .eh_frame_hdr table will be created.
collect2: ld 返回

由于系统里现在有两个版本的GCC:4.4.4和4.5.0的,4.4.4版的是通过sudo apt-get install build-essential 安装的;
4.5.0版的是编译源码包安装的,问题出来了,一个helloword的简单二进制程序无法链接成可执行程序了。
该怎么办?其中4.4.4版的是系统自带的版本,不敢删。而4.5.0版的又是我想用的,也是花了很多时间,才成功编译出来的。 :em11 这还是我第一次编译的成果。
ldg2050
帖子: 34
注册时间: 2010-05-15 2:05

Re: 求助:编译安装GCC4.5.0后出现的奇怪问题

#2

帖子 ldg2050 » 2010-05-22 17:19

:em20 咋没人回复呢?
回复