visual-studio 如何在 Visual Studio 中制作纯程序集项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2718239/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I make a pure assembly project in Visual Studio?
提问by Malfist
How can I make a masm project in Visual Studio? I remember doing this in class a while back, but I've since forgotten, and Google is only getting me inline assembly.
如何在 Visual Studio 中制作 masm 项目?我记得前段时间在课堂上这样做过,但后来我忘记了,谷歌只让我进行内联汇编。
回答by Hans Passant
Start with the Win32 Console mode project template. Delete the .cpp files. Right-click the project in the Solution Explorer window, Custom Build Rules, check Microsoft Macro Assembler. In VS2015 use Build Dependencies, Build Customizations, check masm.
从 Win32 控制台模式项目模板开始。删除 .cpp 文件。右键单击解决方案资源管理器窗口中的项目,自定义构建规则,选中 Microsoft Macro Assembler。在 VS2015 中使用 Build Dependencies,Build Customizations,检查 masm。
Add a new .asm file by right-clicking the Source Files node, Add, Code, C++ File, be sure to use the .asm extension. In the property window change the File Type to C/C++ Code so it gets passed to the linker.
通过右键单击“源文件”节点、“添加”、“代码”、“C++ 文件”来添加新的 .asm 文件,确保使用 .asm 扩展名。在属性窗口中,将文件类型更改为 C/C++ 代码,以便将其传递给链接器。
Linker settings, Manifest file, Generate = No. With these settings I could build and debug this sample .asm file:
链接器设置、清单文件、生成 = 否。通过这些设置,我可以构建和调试此示例 .asm 文件:
.486
.MODEL FLAT
.CODE
START:
ret
END START
回答by sblom
I don't think you can do this in "modern" Visual Studio builds. Here are instructions for a very old one: http://jimweller.com/jim-weller/jim/vc98asmqs/vc98asmqs-4.html
我认为您无法在“现代”Visual Studio 版本中执行此操作。这是一个非常古老的说明:http: //jimweller.com/jim-weller/jim/vc98asmqs/vc98asmqs-4.html
Edit:Looks like you're right--it shipped with VS 2005. Since then, Microsoft has started to distribute MASM for free, and have probably discontinued support for it. :(
编辑:看起来你是对的——它随 VS 2005 一起提供。从那时起,Microsoft 开始免费分发 MASM,并且可能已经停止了对它的支持。:(

