无法生成汇编可执行文件

D:\try>masm 1.asm
Microsoft (R) MASM Compatibility Driver
Copyright (C) Microsoft Corp 1993. All rights reserved.

Invoking: ML.EXE /I. /Zm /c /Ta 1.asm

Microsoft (R) Macro Assembler Version 6.15.8803
Copyright (C) Microsoft Corp 1981-2000. All rights reserved.

Assembling: 1.asm
1.asm(1) : fatal error A1000: cannot open file : 1.obj

为什么无法生成obj文件,代码对的,麻烦帮忙看下

是不是window11的问题?其他电脑上我尝试了下可以的

你的masm添加到系统环境变量了没
用1.asm的绝对路径试一下

masm D:/try/1.asm

win11暂不支持汇编

汇编语言程序的汇编和链接使用的命令分别是ML.EXE和LINK.EXE,不是MASM.EXE

ML Fatal Error A1000

cannot open file: filename

The assembler was unable to open a source, include, or output file.
One of the following may be a cause:

  • The file does not exist.
  • The file is in use by another process.
  • The filename is not valid.
  • A read-only file with the output filename already exists.
  • The current drive is full.
  • The current directory is the root and is full.
  • The device cannot be written to.
  • The drive is not ready.

https://learn.microsoft.com/en-us/cpp/assembler/masm/ml-fatal-error-a1000?view=msvc-170

使用相对路径编译.asm文件生成试试。

1️⃣这样是相对路径(成功生成)

img

2️⃣这样是物理路径(出现错误)

img

如有帮助,还请采纳!谢谢!