ld 报undefined reference to `printf'求解决方法

xljiulong 2011-11-14 01:50:00
.section .data
output:
.asciz "Tis is a section %d\n"
.section .text
.globl _start
_start:
pushl $1
pushl $output
call printf
add $8, %esp
call overhere
pushl $3
pushl $output
call printf
add $8, %esp
pushl $0
call exit
overhere:
pushl %ebp
movl %esp, %ebp
pushl $2
pushl $output
call printf
add $8, %esp
movl %ebp, %esp
popl %ebp
ret
...全文
1297 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xljiulong 2011-11-14
  • 打赏
  • 举报
回复
已解决,连接时需要加上动态链接库
ld -dynamic -linker /lib/ld-linux.so.2 -o **.o -lc **即可
ma100 2011-11-14
  • 打赏
  • 举报
回复
如果是驱动,换成printk
应用程序的话#include <stdio.h>

23,115

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧