Windows 10中的MASM错误A2006-Visual Studio

问题描述

首先,对不起我的英语。好吧,我正在尝试执行从本书中摘录的一些指令,它被称为“现代x86汇编语言程序”。关于Visual Studio如何将C ++和MASM混合在一起的工作,这本书还不太清楚。因为从字面上看,第一个示例给了我一个错误。

ch02_01.asm(15):错误A2006:未定义符号:r8d

代码不是很广泛:

ch02_01.asm(15):错误A2006:未定义符号:r8d

; ------------------------------------------------------
;                       Ch02_01.asm
; ------------------------------------------------------

; extern "C" int IntegerAddSub_(int a,int b,int c,int d);
    
    .model flat
    .code

IntegerAddSub_ proc

; Calculate a + b + c - d
        mov eax,ecx                ;eax = a
        add eax,edx                ;eax = a + b
        add eax,r8d                ;eax = a + b + c
        sub eax,r9d                ;eax = a + b + c - d

        ret                         ;return result to caller
IntegerAddSub_ endp
        end

解决方法

使用r9dselect * from c where c.Id=<someId> and c.Version > <someVersion> order by c.Version asc 意味着程序集实际上是x64本机的,因此它需要使用64位版本的MASM。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...