永发信息网

masm32 V10编译出错

答案:1  悬赏:20  手机版
解决时间 2021-04-26 07:01
  • 提问者网友:相思似海深
  • 2021-04-26 01:44

程序: 书上的例程(文件名P10.asm)
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kerne132.inc
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

.date
MsgCaption db "hi,masm32!",0
MsgBoxText db "win32 assembly is great!",0

.code
start:
invoke MessageBox,NULL,addr MsgBoxText, addr MsgCaption,MB_ok
invoke Exitprocess,NULL
end start

我用MASM32 V10编译

C:\masm32\bin>ml.exe /c /coff p10.ASM
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.

Assembling: p10.ASM
p10.ASM(5) : fatal error A1000: cannot open file : \masm32\include\kerne132.inc

因为上面提示的是 不能打开那个文件,其实文件是存在的 所以换了个程序
; p227.asm
;
.model flat,c
PUBLIC power2
_TEXT SEGMENT WORD PUBLIC 'CODE'
_power2 PROC

push ebp
mov ebp,esp
mov eax,[ebp+4]
mov ecx,[ebp+6]
mov eax,cl
pop ebp
ret

_power2 ENDP
_TEXT ENDS
END

执行结果:
C:\masm32\bin>ml.exe /c /coff p227.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.

Assembling: p227.asm
p227.asm(3) : error A2085: instruction or register not accepted in current CPU m
ode
p227.asm(8) : error A2085: instruction or register not accepted in current CPU m
ode
p227.asm(9) : error A2085: instruction or register not accepted in current CPU m
ode
p227.asm(10) : error A2085: instruction or register not accepted in current CPU
mode
p227.asm(11) : error A2085: instruction or register not accepted in current CPU
mode
p227.asm(12) : error A2085: instruction or register not accepted in current CPU
mode
p227.asm(13) : error A2085: instruction or register not accepted in current CPU
mode
p227.asm(4) : error A2006: undefined symbol : power2

最佳答案
  • 五星知识达人网友:英雄的欲望
  • 2021-04-26 02:33
(1)kerne132.inc拼写错误,应该是kernel32.inc
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯