免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123下一页
最近访问板块 发新帖
查看: 41530 | 回复: 24
打印 上一主题 下一主题

编译错误:undefined reference to [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-10-12 15:51 |只看该作者 |倒序浏览
编译的时候出现很多这样的错误:
undefined reference to 'strcpy'
undefined reference to 'readcontrol'
......................................
edu$(TARGET).bin : $(DIAGS_SOBJ) $(DIAGS_COBJ) $(HFILES) $(CFILES) $() $(LIBS)$(TCAM_OBJS)
        $(LD) $(LDFLAGS) -o edu$(TARGET).tmp -Map edu$(TARGET).map $(ROMOBJS) $(LIBS) \
        $(WIND_BASE)\host\x86-win32\lib\gcc-lib\arm-wrs-vxworks\2.9-010413\libgcc.a \
        $(WIND_BASE)\host\x86-win32\arm-wrs-vxworks\lib\libc.a $(TCAM_OBJS)
        objcopyarm -O binary edu$(TARGET).tmp edu$(TARGET).bin     [/color]#####error in this line

makefile文件中上面蓝色的那行出错,各模块单独编译均能通过,请各位指点一下,谢谢

论坛徽章:
0
2 [报告]
发表于 2007-10-12 17:20 |只看该作者
#include <string.h>
有这个头吗

论坛徽章:
95
程序设计版块每日发帖之星
日期:2015-09-05 06:20:00程序设计版块每日发帖之星
日期:2015-09-17 06:20:00程序设计版块每日发帖之星
日期:2015-09-18 06:20:002015亚冠之阿尔艾因
日期:2015-09-18 10:35:08月度论坛发贴之星
日期:2015-09-30 22:25:002015亚冠之阿尔沙巴布
日期:2015-10-03 08:57:39程序设计版块每日发帖之星
日期:2015-10-05 06:20:00每日论坛发贴之星
日期:2015-10-05 06:20:002015年亚冠纪念徽章
日期:2015-10-06 10:06:482015亚冠之塔什干棉农
日期:2015-10-19 19:43:35程序设计版块每日发帖之星
日期:2015-10-21 06:20:00每日论坛发贴之星
日期:2015-09-14 06:20:00
3 [报告]
发表于 2007-10-12 20:19 |只看该作者
原帖由 bobodu 于 2007-10-12 15:51 发表
        objcopyarm -O binary edu$(TARGET).tmp edu$(TARGET).bin     #####error in this line

makefile文件中上面蓝色的那行出错,各模块单独编译均能通过,请各位指点一下,谢谢

出什么错了?

论坛徽章:
0
4 [报告]
发表于 2007-10-12 22:32 |只看该作者
原帖由 xjtdy888 于 2007-10-12 17:20 发表
#include
有这个头吗

这个应该是正解
objcopyarm -O binary edu$(TARGET).tmp edu$(TARGET).bin
上面这一句应该只是把tmp文件专为二进制的文件,方便烧写而已

[ 本帖最后由 DesignInside 于 2007-10-12 22:33 编辑 ]

论坛徽章:
0
5 [报告]
发表于 2007-10-15 09:57 |只看该作者
感谢各位的回复
string.h肯定有的,因为在tornado2.0上编译都能通过的,上面的结果是在tornado2.2环境下编译的,错误就是一堆undefined reference to ...

"这个应该是正解
objcopyarm -O binary edu$(TARGET).tmp edu$(TARGET).bin
上面这一句应该只是把tmp文件专为二进制的文件,方便烧写而已
"
上面的分析没有错,我看makefile的时候,到这句就开始出现undefined reference to 。。。错误,我不知道是哪出错了

论坛徽章:
0
6 [报告]
发表于 2007-10-16 10:06 |只看该作者

回复 #5 bobodu 的帖子

是你没有链接C库造成的

论坛徽章:
0
7 [报告]
发表于 2007-10-16 11:00 |只看该作者
web_serf,你好,能说得具体一点吗?要链接什么样的C库?

论坛徽章:
0
8 [报告]
发表于 2007-10-16 13:19 |只看该作者
原帖由 bobodu 于 2007-10-16 11:00 发表
web_serf,你好,能说得具体一点吗?要链接什么样的C库?

在ld时,加上-lc试试

论坛徽章:
95
程序设计版块每日发帖之星
日期:2015-09-05 06:20:00程序设计版块每日发帖之星
日期:2015-09-17 06:20:00程序设计版块每日发帖之星
日期:2015-09-18 06:20:002015亚冠之阿尔艾因
日期:2015-09-18 10:35:08月度论坛发贴之星
日期:2015-09-30 22:25:002015亚冠之阿尔沙巴布
日期:2015-10-03 08:57:39程序设计版块每日发帖之星
日期:2015-10-05 06:20:00每日论坛发贴之星
日期:2015-10-05 06:20:002015年亚冠纪念徽章
日期:2015-10-06 10:06:482015亚冠之塔什干棉农
日期:2015-10-19 19:43:35程序设计版块每日发帖之星
日期:2015-10-21 06:20:00每日论坛发贴之星
日期:2015-09-14 06:20:00
9 [报告]
发表于 2007-10-16 19:06 |只看该作者
原帖由 bobodu 于 2007-10-16 11:00 发表
web_serf,你好,能说得具体一点吗?要链接什么样的C库?

把具体的错误信息贴上来。

论坛徽章:
0
10 [报告]
发表于 2007-10-17 15:56 |只看该作者
错误信息如下:
D:\Tornado2.2\host\x86-win32\lib\gcc-lib\arm-wrs-vxworks\2.9-010413\libgcc.a \
D:\Tornado2.2\host\x86-win32\arm-wrs-vxworks\lib\libc.a ..\tcam\tcam.o
ipl.o: In function `stepoff':
ipl.o(.text+0x2054: undefined reference to `_eduEntry'
ipl.o: In function `gwjstr':
ipl.o(.text+0x20bb: undefined reference to `__data_start__'
main.o: In function `getVersion':
main.o(.text+0x2b0): undefined reference to `readChipId'
commands.o: In function `parseCmd':
commands.o(.text+0xed: undefined reference to `strcpy'
commands.o: In function `cmd_ion':
commands.o(.text+0x1e10): undefined reference to `readControl'
commands.o(.text+0x1e30): undefined reference to `flushIcache'
commands.o(.text+0x1e34): undefined reference to `readControl'
commands.o(.text+0x1e40): undefined reference to `writeControl'
commands.o: In function `cmd_don':
commands.o(.text+0x1ec0): undefined reference to `readControl'
commands.o(.text+0x1ee0): undefined reference to `flushDcache'
commands.o(.text+0x1ee4): undefined reference to `readControl'
commands.o(.text+0x1ef0): undefined reference to `writeControl'
commands.o: In function `cmd_doff':
commands.o(.text+0x1f14): undefined reference to `clearDcacheDisable'
commands.o: In function `cmd_ioff':
commands.o(.text+0x1fc4): undefined reference to `readControl'
commands.o(.text+0x1fcc): undefined reference to `writeControl'
commands.o(.text+0x1fd4): undefined reference to `flushIcache'
commands.o: In function `cmd_rcon':
commands.o(.text+0x1fec): undefined reference to `readControl'
commands.o: In function `cmd_wcon':
commands.o(.text+0x202c): undefined reference to `writeControl'
commands.o(.text+0x2030): undefined reference to `readControl'
commands.o: In function `cmd_rpsr':
commands.o(.text+0x2054): undefined reference to `readPsr'
commands.o: In function `cmd_wpsr':
commands.o(.text+0x208: undefined reference to `writePsr'
commands.o(.text+0x208c): undefined reference to `readPsr'
dis.o: In function `getStackType':
dis.o(.text+0x474): undefined reference to `strcpy'
dis.o(.text+0x484): undefined reference to `strcpy'
dis.o(.text+0x494): undefined reference to `strcpy'
dis.o(.text+0x4a4): undefined reference to `strcpy'
dis.o: In function `getRegList':
dis.o(.text+0x4f: undefined reference to `strcat'
dis.o(.text+0x514): undefined reference to `strcat'
dis.o(.text+0x520): undefined reference to `strcat'
dis.o: In function `getCond':
dis.o(.text+0x654): undefined reference to `strcpy'
dis.o(.text+0x664): undefined reference to `strcpy'
dis.o(.text+0x674): undefined reference to `strcpy'
dis.o(.text+0x684): undefined reference to `strcpy'
dis.o(.text+0x694): undefined reference to `strcpy'
dis.o(.text+0x6a4): more undefined references to `strcpy' follow
dis.o: In function `reverseStr':
dis.o(.text+0x88: undefined reference to `memcpy'
dis.o(.text+0x89: undefined reference to `memset'
dis.o(.text+0x8a4): undefined reference to `strcpy'
..\test\testlib.a(main.o): In function `allTest':
main.o(.text+0x650): undefined reference to `readControl'
..\test\testlib.a(memory.o): In function `memoryTest':
memory.o(.text+0x180): undefined reference to `readControl'
memory.o(.text+0x194): undefined reference to `readControl'
..\test\testlib.a(memory.o): In function `byteTest':
memory.o(.text+0x70c): undefined reference to `memcpy'
memory.o(.text+0x724): undefined reference to `memcpy'
memory.o(.text+0x75: undefined reference to `memcpy'
..\test\testlib.a(timers.o): In function `timerTest':
timers.o(.text+0x14: undefined reference to `readPsr'
timers.o(.text+0x150): undefined reference to `writePsr'
timers.o(.text+0x15c): undefined reference to `atoi'
timers.o(.text+0x26c): undefined reference to `readPsr'
timers.o(.text+0x274): undefined reference to `writePsr'
timers.o(.text+0x2c4): undefined reference to `IRQHandler'
..\test\testlib.a(timers.o): In function `installHandler':
timers.o(.text+0x330): undefined reference to `flushIcache'
timers.o(.text+0x334): undefined reference to `flushDcache'
timers.o(.text+0x33: undefined reference to `drainWriteBuffer'
..\test\testlib.a(i82559tst.o): In function `getethaddr':
i82559tst.o(.text+0x1d60): undefined reference to `strtoul'
..\test\testlib.a(i82559tst.o): In function `findAll82559':
i82559tst.o(.text+0x2130): undefined reference to `readControl'
..\test\testlib.a(fidsflash.o): In function `test':
fidsflash.o(.text+0x1fc): undefined reference to `bcmp'
..\lib\iolib.a(tty.o): In function `getCmdLine':
tty.o(.text+0x4f0): undefined reference to `readControl'
..\lib\iolib.a(mac.o): In function `MacScan':
mac.o(.text+0xc4): undefined reference to `memcpy'
mac.o(.text+0x138): undefined reference to `memcpy'
mac.o(.text+0x170): undefined reference to `memcpy'
..\tcam\tcam.o: In function `TCAM_Table_Create':
..\tcam\tcam.o(.text+0x29a8): undefined reference to `memset'
..\tcam\tcam.o: In function `TCAM_Table_Entry_Add':
..\tcam\tcam.o(.text+0x2ea8): undefined reference to `memset'
..\tcam\tcam.o: In function `TCAM_Table_Entry_DeleteByIndex':
..\tcam\tcam.o(.text+0x30dc): undefined reference to `memset'
..\tcam\tcam.o: In function `TCAM_Table_Entry_DeleteByContent':
..\tcam\tcam.o(.text+0x32a8): undefined reference to `memset'
..\tcam\tcam.o: In function `TCAM_Table_Entry_LookupByContent':
..\tcam\tcam.o(.text+0x3600): undefined reference to `memset'
..\tcam\tcam.o(.text+0x37bc): more undefined references to `memset' follow
make: *** [eduIXPSI.bin] Error 0x1

D:\IXP1200\BoardSupport\Diagnostics\Rom>
加了lc也不行
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP