汇编masm链接器“链接:额外操作数"中的错误 [英] Error in Assembly masm linker 'link: extra operand'

查看:227
本文介绍了汇编masm链接器“链接:额外操作数"中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了Masm进行汇编编程,但是代码下方的链接存在问题

I installed masm for assembly programming but i have problem with link below code

.586
.MODEL FLAT
.STACK 4096
INCLUDE io.h

.DATA
prompt      BYTE "shalgham", 0

.CODE
_main       PROC
            output  prompt

            mov     eax, 0
            ret
_main       ENDP
END

当我通过命令行汇编以上代码时,一切都很好
但是当我要链接到下面时,错误将在命令行中打印

when i assemble above code by commandLine every thing is ok
but when i want to link it below error will be print in commandLine

C:\Users\mahdi\Desktop\New folder>ml /c /coff simple.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

 Assembling: simple.asm

C:\Users\mahdi\Desktop\New folder>link /subsystem:console /entry:main simple.obj
 io.obj Kernel32.Lib
link: extra operand `simple.obj'
Try `link --help' for more information.  

当我使用Visual Studio 2010时,将打印以下错误.

And when i use visual studio 2010 below error will be printed.

1>InitializeBuildStatus:
1>  Touching "Debug\console32.unsuccessfulbuild".
1>_MASM:
1>  Assembling [Inputs]...
1>GenerateTargetFrameworkMonikerAttribute:
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>temp.obj : error LNK2001: unresolved external symbol itoaproc
1>temp.obj : error LNK2001: unresolved external symbol atoiproc
1>temp.obj : error LNK2001: unresolved external symbol dtoaproc
1>temp.obj : error LNK2001: unresolved external symbol atodproc
1>temp.obj : error LNK2001: unresolved external symbol inproc
1>temp.obj : error LNK2019: unresolved external symbol outproc referenced in function _main
1>E:\programming\assembly\VS2010_files\console32\Debug\console32.exe : fatal error LNK1120:     6 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:06.14
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

在问这个问题之前,我非常搜索它,但未找到解决方案

before asking this question i search it very but not solution found

推荐答案

尽管@Michael回答了这个问题,但我想澄清一下.

Although this question was answered by @Michael, I would like to make it clear.

我们必须将CYGWIN路径置于MS Visual Studio路径的后面.

We have to put the CYGWIN path stand behind the MS Visual Studio path.

 Path=....C:\Program Files (x86)\Microsoft Visual Studio\VC98\bin;C:\cygwin\bin

打开Windows命令提示符:

Open Windows command prompt:

cmd
link --help

请确保:

Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

这篇关于汇编masm链接器“链接:额外操作数"中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆