我的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 %dn","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

在我按下debug之后,我有3个错误:1>main.obj:错误LNK2019:函数_main中引用的未解析外部符号_printf1>main.obj:错误LNK2019:函数_main中引用的未解析外部符号_scanf1>链接:错误LNK2001:未解析的外部符号_mainCRT启动

我还想补充一点,我从Builder Dependencies中选择了masm,并在Linker Input中添加了库msvcrt.lib和legacy_stdio_definitions.lib。你知道问题出在哪里吗?

As@RbMn指出:将msvcrt.lib和/或libcmt.lib添加到链接器搜索路径。

相关内容

  • 没有找到相关文章

最新更新