debugging - 我的 MASM 代码在调试后显示 3 个错误,但我不知道如何修复它们。有人能帮我吗?
问题描述
;programul citeste de la tastatura doua numere intregi si le afiseaza.
.386 ;folosim instructiuni cu operanzi pe 32 biti
.MODEL FLAT, C ;memoria este organizata liniar si conventia de apel a functiilor este cea din C
.STACK 100h ;dimensunea stivei alocate
printf PROTO arg1:ptr BYTE, printlist:VARARG
scanf PROTO arg2:ptr BYTE, inputlist:VARARG ;prototipurile functiilor printf si scanf
.DATA
format1 BYTE "%s",0
format2 BYTE "%d",0
format3 BYTE "%s %04d si %04d",10,0
mesaj1 BYTE "Introduceti numerele:",0Ah,0
mesaj2 BYTE "num1=",0
mesaj3 BYTE "num2=",0
mesaj4 BYTE 0Ah,"Numerele sunt: ",0
num1 SDWORD ? ;sdword=signed double word --> numar de 32 de biti cu semn; echivalentul int
num2 SDWORD ?
.CODE
main PROC
;printf("%s","Introduceti numerele:\n");
INVOKE printf, ADDR format1, ADDR mesaj1
;printf("%s","num1=");
;scanf("%d",&num1);
;printf("%s","num2=");
;scanf("%d",&num2);
;printf("%s %d si %d\n","\nNumerele sunt:",num1,num2);
INVOKE printf, ADDR format1,ADDR mesaj2
INVOKE scanf, ADDR format2,ADDR num1
INVOKE printf, ADDR format1,ADDR mesaj3
INVOKE scanf, ADDR format2,ADDR num2
INVOKE printf, ADDR format3, ADDR mesaj4, num1, num2
ret
main ENDP
END
按调试后,我有 3 个错误: 1>main.obj:错误 LNK2019:未解析的外部符号 _printf 在函数 _main 中引用 1>main.obj:错误 LNK2019:未解析的外部符号 _scanf 在函数 _main 1>LINK 中引用:错误 LNK2001 : 未解析的外部符号 _mainCRTStartup
我还想补充一点,我从 Builder Dependencies 中选择了 masm,并在 Linker Input 中添加了库 msvcrt.lib 和 legacy_stdio_definitions.lib。你知道可能是什么问题吗?
解决方案
推荐阅读
- python - 在 Python 上将数据写入 CSV 会将所有数据写入第一列
- html - 让 ngIf 根据开始字母对元素进行排序
- java - 如果未使用所有依赖项 jar 编译,则上传到 Apache Livy 的应用程序将失败
- symfony - 从前端编辑 Symfony 实体
- windows - Symbolic Link <=> Junction <=> Shortcut 有什么区别?
- python - Wagtail:将图像添加到自定义用户模型
- asp.net-core - CustomClaimsTransformer 中的 IHttpContextAccessor 会话无效操作异常
- python - Python:如何在 1 行中从列表中打印字符串和数字?
- java - 使用 FCM、SQL、java 向多个设备发送推送通知
- ruby-on-rails - Rails 重定向操作:索引,不起作用