在Visual Studio编译大会

编程入门 行业动态 更新时间:2024-10-27 10:18:47
本文介绍了在Visual Studio编译大会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你如何使用VS编译装配code?

How do you compile assembly code using VS?

我想要做的就是编译并在Visual Studio 2010中运行汇编源文件是什么。

What I want to do is compile and run an assembly source file in Visual Studio 2010.

我创建了一个VC ++项目,并在文件中插入一些汇编code code.asm 。

I've created a VC++ project, and inserted some assembly code in a file code.asm.

.586 ;Target processor. Use instructions for Pentium class machines .MODEL FLAT, C ;Use the flat memory model. Use C calling conventions .STACK ;Define a stack segment of 1KB (Not required for this example) .DATA ;Create a near data segment. Local variables are declared after ;this directive (Not required for this example) .CODE ;Indicates the start of a code segment. clear PROC xor eax, eax xor ebx, ebx ret clear ENDP END

但问题是,当你尝试编译这个,你得到

However the problem is when you try and compile this, you get

LINK : error LNK2001: unresolved external symbol _mainCRTStartup

我没去,使构建定制 masm.targets (右键单击项目>生成自定义..),但无济于事。

I did go and enable the build customization masm.targets (right click project > Build Customizations..) but to no avail

推荐答案

听起来好像自定义生成未启用.ASM文件的规则。右键单击该项目,自定义生成规则,勾选Microsoft宏汇编程序。随着清底指令和禁用增量链接我得到一个干净的构建。

Sounds to me like the custom build rules for .asm files isn't enabled. Right-click the project, Custom Build Rules, tick "Microsoft Macro Assembler". With the "END clear" directive and disabling incremental linking I'm getting a clean build.

这对VS2010不同。用鼠标右键单击项目,创建自定义设置,勾选MASM。右键单击该文件.ASM,属性,改变项目类型为Microsoft宏汇编程序。

It's different for VS2010. Right-click project, Build customizations, tick "masm". Right-click the .asm file, Properties, change Item Type to "Microsoft Macro Assembler".

更多推荐

在Visual Studio编译大会

本文发布于:2023-11-05 03:55:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1559823.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:大会   Visual   Studio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!