multiple definition of `_start'
来源:互联网 发布:如何评价新东方 知乎 编辑:程序博客网 时间:2024/05/01 14:39
1.关于GCC编译问题:
huge.bin(.text+0x0): In function `_start':
: multiple definition of `_start'
2.这种问题,碰到很多次了, 因为是新手,这样就给我带来了很大的麻烦!
3.编译虽然成功了 但是 通过arm-linux-gcc -v huge.bin
下面贴出全部的 编译信息:
book@book-desktop:~/TQ2440/huge/build/exes$
book@book-desktop:~/TQ2440/huge/build/exes$ arm-linux-gcc -v huge.bin
Reading specs from /work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/specs
Configured with: /work/tools/create_crosstools/crosstool-0.43/build/arm-linux/gcc-3.4.5-glibc-2.3.6/gcc-3.4.5/configure --target=arm-linux --host=i686-host_pc-linux-gnu --prefix=/work/tools/gcc-3.4.5-glibc-2.3.6 --with-float=soft --with-headers=/work/tools/gcc-3.4.5-glibc-2.3.6/arm-linux/include --with-local-prefix=/work/tools/gcc-3.4.5-glibc-2.3.6/arm-linux --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
Thread model: posix
gcc version 3.4.5
collect2: ld terminated with signal 11 [Segmentation fault]
huge.bin(.text+0x0): In function `_start':
: multiple definition of `_start'
/work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/../../../../arm-linux/lib/crt1.o(.text+0x0): first defined here
huge.bin(.fini+0x0):/work/tools/create_crosstools/crosstool-0.43/build/arm-linux/gcc-3.4.5-glibc-2.3.6/build-glibc/csu/crti.S:52: multiple definition of `_fini'
/work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/../../../../arm-linux/lib/crti.o(.fini+0x0):/work/tools/create_crosstools/crosstool-0.43/build/arm-linux/gcc-3.4.5-glibc-2.3.6/build-glibc/csu/crti.S:13: first defined here
huge.bin(.got+0x0): multiple definition of `_GLOBAL_OFFSET_TABLE_'
/work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/../../../../arm-linux/lib/crti.o(.got.plt+0x0): first defined here
huge.bin(.rodata+0x0): multiple definition of `_IO_stdin_used'
/work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/../../../../arm-linux/lib/crt1.o(.rodata+0x0): first defined here
huge.bin(.data+0x0): In function `__data_start':
: multiple definition of `__data_start'
/work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/../../../../arm-linux/lib/crt1.o(.data+0x0): first defined here
huge.bin(.data+0x4): In function `__data_start':
: multiple definition of `__dso_handle'
/work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/crtbegin.o(.data+0x0): first defined here
huge.bin(.init+0x0):/work/tools/create_crosstools/crosstool-0.43/build/arm-linux/gcc-3.4.5-glibc-2.3.6/build-glibc/csu/crti.S:37: multiple definition of `_init'
/work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/../../../../arm-linux/lib/crti.o(.init+0x0): first defined here
/work/tools/gcc-3.4.5-glibc-2.3.6/lib/gcc/arm-linux/3.4.5/../../../../arm-linux/lib/crti.o(.dynamic+0x0): multiple definition of `_DYNAMIC'
huge.bin(.dynamic+0x0): first defined here
3.只能求助论坛了:
-l
-static 禁止与共享函数库连接。
-shared 尽量与共享函数库连接
date:2012-10-26
2013-4-22:来自StudyOS的链接不成功报错:
arm-linux-ld -Bstatic -T /home/book/TQ2440/StudyOS/startup/StudyOS.lds
/home/book/TQ2440/StudyOS/major/libmain.a(main.o)(.data+0x44): multiple definition of `BOOTINFO'
startup/nand.o(.data+0x0): first defined here
/home/book/TQ2440/StudyOS/drivers/interrupt/libinterrupt.a(interrupt.o)(.data+0x84):
startup/nand.o(.data+0x0):
/home/book/TQ2440/StudyOS/drivers/hardware/libhardware.a(lcddriver.o)(.data+0x18):
startup/nand.o(.data+0x0):
/home/book/TQ2440/StudyOS/drivers/hardware/libhardware.a(lcdappl.o)(.data+0x0):
startup/nand.o(.data+0x0):
/home/book/TQ2440/StudyOS/drivers/hardware/libhardware.a(mouse.o)(.data+0x0):
startup/nand.o(.data+0x0):
/home/book/TQ2440/StudyOS/drivers/hardware/libhardware.a(touch_screen.o)(.data+0x0):
startup/nand.o(.data+0x0):
/home/book/TQ2440/StudyOS/drivers/hardware/libhardware.a(tc_correct.o)(.data+0x0):
startup/nand.o(.data+0x0):
/home/book/TQ2440/StudyOS/drivers/hardware/libhardware.a(timer.o)(.data+0x0):
startup/nand.o(.data+0x0):
make: *** [StudyOS] Error 1
PS:这种在编译的时候能够成功,但链接不成功的例子,在我们 Linux 环境编译下,已经不是第一次了.
下面我们来贴一下源代码中
结构体原型:
struct BOOT
{
U8 cyls,leds,vmode,reserve;
U16 scrn_x,scrn_y;
U16 *vram;
}BOOTINFO = {0,0,0,0,480,272,NULL};
用到这个变量的文件夹:
Struct.h (include):typedef struct BOOT BOOT_INFO;
Lcdappl.c (drivers\hardware):static BOOT_INFO *bootinfo;
Lcddriver.c (drivers\hardware): static
Mouse.c (drivers\hardware): static
Tc_correct.c (drivers\hardware): static
Touch_screen.c (drivers\hardware): static
PS:综上,如果是比较大的项目,笔者建议采用第二种 方法, 一是便于“维护”,二是“可读性性”比较好.
由于笔者刚开始没有使用第二种方法,导致后来项目无法写下去了,而且很难修改,动不动就报错.
所以前面的错误也迎刃而解了。
转载:http://blog.sina.com.cn/s/blog_87c063060101bmtt.html
- multiple definition of `_start'
- 【问题】multiple definition of `_start'
- "multiple definition of" 错误
- multiple definition of...
- multiple definition of...
- 解决 multiple definition of
- extern: multiple definition of
- gcc: multiple definition of
- multiple definition of XXXX
- 解决 multiple definition of
- multiple definition of
- 116、multiple definition of
- gcc: multiple definition of
- multiple definition of
- 解决multiple definition of
- 解决 multiple definition of***
- “multiple definition of ”
- 解决 multiple definition of
- getNextElement与nextSibling的疑惑
- cin.get与cin.getline
- 真正解决问题:maven eclipse tomcat java.lang.ClassNotFoundException: org.springframework.web.context.Contex
- Android 混淆代码总结
- iOS判断手机上是否安装微信或qq等应用
- multiple definition of `_start'
- 数据库第六次作业 王小芬 2013212954 理学院
- ios数据存储方式FMDB
- Struts2接收请求参数
- 使用matlab计算DFT时需要注意的幅值对应问题
- 看门狗驱动程序
- C++ 模板笔记
- Cocos2d-x学习笔记(九)纹理CCTexture2D和精灵CCSprite
- Android GradientDrawable高级应用 以后完全用不上美工了