MASM32调用标准输出不会有任何输出 [英] masm32 invoking stdout gives no output
本文介绍了MASM32调用标准输出不会有任何输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用MASM32来编译和Windows 7的链接,这工作只是低于code罚款。然而调用stdout不是简单地印在我的命令提示符下任何东西。我究竟做错了什么?
.386.MODEL平,STDCALL
选项casemap:无 包括C:\\ MASM32 \\包括\\ windows.inc
包括C:\\ MASM32 \\包括\\ kernel32.inc
包括C:\\ MASM32 \\包括\\ user32.inc
包括C:\\ MASM32 \\包括\\ masm32.inc includelib C:\\ MASM32 \\ LIB \\ KERNEL32.LIB
includelib C:\\ MASM32 \\ LIB \\ USER32.LIB
includelib C:\\ MASM32 \\ LIB \\ masm32.lib。数据
MsgBoxCaption DB的消息框标题,0
MsgBoxText DBWin32汇编是伟大的!,0。数据?
;声明未初始化的字节,简称所在地总和
总之DD?。code
开始:
MOV EAX,1D
MOV EBX,1D ;结果将被存储在第一个参数
添加EAX,EBX ;推EAX入堆栈
推EAX ;流行音乐的价值总和成
流行总和 ;调用的MessageBox,NULL,地址MsgBoxText,地址MsgBoxCaption,MB_OK 调用标准输出地址MsgBoxCaption
调用标准输出地址总和 ;与状态code 0退出
调用了ExitProcess,0
年底启动
解决方案
解决...我用错了参数的链接
如何给它正确链接
毫升/ C / COFF / CP hello.asm
链接/子系统:控制台/ LIBPATH:C:\\ MASM32 \\ LIB hello.obj
怎么还不来这个节目链接
毫升/ C / COFF / CP hello.asm
链接/子系统:窗户/ LIBPATH:C:\\ MASM32 \\ LIB hello.obj
I am using masm32 to compile and link on windows 7, which works just fine with below code. However invoking stdOut isn't simply printing anything on my command prompt. what am i doing wrong?
.386
.model flat, stdcall
option casemap:none
include C:\masm32\include\windows.inc
include C:\masm32\include\kernel32.inc
include C:\masm32\include\user32.inc
include C:\masm32\include\masm32.inc
includelib C:\masm32\lib\kernel32.lib
includelib C:\masm32\lib\user32.lib
includelib C:\masm32\lib\masm32.lib
.data
MsgBoxCaption db "Message Box Caption", 0
MsgBoxText db "Win32 Assembly is great!", 0
.data?
; declare an uninitialized byte, referred to as location sum
sum dd ?
.code
start:
mov eax, 1d
mov ebx, 1d
; result will be stored in the first argument
add eax, ebx
; push eax onto the stack
push eax
; pop value into sum
pop sum
; invoke MessageBox, NULL, addr MsgBoxText, addr MsgBoxCaption, MB_OK
invoke StdOut, addr MsgBoxCaption
invoke StdOut, addr sum
; exit with status code 0
invoke ExitProcess, 0
end start
解决方案
Solved... i was using the wrong parameter for the linker
How to link it correctly
ml /c /coff /Cp hello.asm
link /subsystem:console /libpath:c:\masm32\lib hello.obj
How NOT to link this program
ml /c /coff /Cp hello.asm
link /subsystem:windows /libpath:c:\masm32\lib hello.obj
这篇关于MASM32调用标准输出不会有任何输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文