2011-12-30 28 views
2

我正在运行一些MASM32示例(来自www.masm32.com),并且我注意到在我的命令行框中控制台输出为空(程序编译,链接和运行但没有输出。在win32上没有使用MASM与程序组装的控制台输出

.486         ; create 32 bit code 
    .model flat, stdcall     ; 32 bit memory model 
    option casemap :none     ; case sensitive 

    include \masm32\include\windows.inc  ; always first 
    include \masm32\macros\macros.asm  ; MASM support macros 
    include \masm32\include\masm32.inc 
    include \masm32\include\gdi32.inc 
    include \masm32\include\user32.inc 
    include \masm32\include\kernel32.inc 
    includelib \masm32\lib\masm32.lib 
    includelib \masm32\lib\gdi32.lib 
    includelib \masm32\lib\user32.lib 
    includelib \masm32\lib\kernel32.lib 

    .code      ; Tell MASM where the code starts 


start:       ; The CODE entry point to the program 

    print chr$("Hey, this actually works.",13,10) 
    exit 


end start      ; Tell MASM where the program ends 
+0

有一个'print'宏? – cHao 2011-12-30 02:08:14

+0

Dopey我,用错误的批处理文件来构建示例(使用build,bat,应该使用buildc.bat)。 – 2011-12-30 02:20:17

+0

确实有一个打印宏,它非常方便。 :-) – 2011-12-30 12:52:43

回答

3

当你为Win32链接PE程序,你可以在运行标记所需的子系统或者“GUI”或“控制台”。如果您已将这是一个GUI模式程序,然后从命令提示符处执行的EXE Windows不会将控制台连接到您输入的窗口,这听起来就像您所描述的症状一样

请确保您链接哟用“控制台”子系统标志运行的可执行文件。

相关问题