首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 嵌入开发 > 汇编语言 >

汇编编译出错:LINK : fatal error LNK1221: a subsystem can't be inferred and …该如何解决

2012-02-04 
汇编编译出错:LINK : fatal error LNK1221: a subsystem cant be inferred and ……例子程序是《Windows环境

汇编编译出错:LINK : fatal error LNK1221: a subsystem can't be inferred and ……
例子程序是《Windows环境下32位汇编语言》第六章的程序,
Timer.asm源码如下:
.386
.model flat,stdcall
option casemap :none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Include 文件定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
includewindows.inc
includeuser32.inc
includelibuser32.lib
includekernel32.inc
includelibkernel32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ID_TIMER1equ1
ID_TIMER2equ2
ICO_1equ1
ICO_2equ2
DLG_MAINequ1
IDC_SETICONequ100
IDC_COUNTequ101
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 数据段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data?
hInstancedd?
hWinMaindd?
dwCountdd?
idTimerdd?
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 代码段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 定时器过程
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_ProcTimerproc_hWnd,uMsg,_idEvent,_dwTime

pushad
invokeGetDlgItemInt,hWinMain,IDC_COUNT,NULL,FALSE
inceax
invokeSetDlgItemInt,hWinMain,IDC_COUNT,eax,FALSE
popad
ret

_ProcTimerendp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 窗口过程
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_ProcDlgMainprocuses ebx edi esi,hWnd,uMsg,wParam,lParam
moveax,uMsg
;**************************************************
.ifeax == WM_TIMER
moveax,wParam
.ifeax == ID_TIMER1
incdwCount
moveax,dwCount
andeax,1
inceax
invokeLoadIcon,hInstance,eax
invokeSendDlgItemMessage,hWnd,\
IDC_SETICON,STM_SETIMAGE,\
IMAGE_ICON,eax
.elseifeax == ID_TIMER2
invokeMessageBeep, -1
.endif
;**************************************************
.elseifeax == WM_INITDIALOG
pushhWnd
pophWinMain
invokeSetTimer,hWnd,ID_TIMER1,250,NULL
invokeSetTimer,hWnd,ID_TIMER2,2000,NULL
invokeSetTimer,NULL,NULL,1000,addr _ProcTimer
movidTimer,eax
;**************************************************
.elseifeax == WM_CLOSE
invokeKillTimer,hWnd,ID_TIMER1


invokeKillTimer,hWnd,ID_TIMER2
invokeKillTimer,NULL,idTimer
invokeEndDialog,hWnd,NULL
;**************************************************
.endif
moveax,FALSE
ret

_ProcDlgMainendp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
start:
invokeGetModuleHandle,NULL
movhInstance,eax
invokeDialogBoxParam,hInstance,DLG_MAIN,\
NULL,offset _ProcDlgMain,NULL
invokeExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
endstart


Timer.rc源码:
#include<resource.h>
#defineDLG_MAIN1
#defineICO_11
#defineICO_22
#defineIDC_SETICON100
#defineIDC_COUNT101
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ICO_1ICON"1.ico"
ICO_2ICON"2.ico"
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DLG_MAIN DIALOG 50, 50, 113, 40
STYLEDS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "定时器例子"
FONT 9, "宋体"
{
ICON ICO_1, IDC_SETICON, 8, 9, 18, 21
LTEXT "计数: ", -1, 35, 16, 25, 10
LTEXT "", IDC_COUNT, 62, 16, 40, 10
}

编译时提示如下信息:

Microsoft (R) Program Maintenance Utility Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.

  Link Timer.obj Timer.res
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

LINK : fatal error LNK1221: a subsystem can't be inferred and must be defined
NMAKE : fatal error U1077: 'D:\masm32\bin\Link.EXE' : return code '0x4c5'
Stop.

求助啊,

[解决办法]
link /subsystem:windows xxx.obj yyy.res
[解决办法]
楼主没用MASM32的qeditor?
[解决办法]
我悟了
两种可能:
1、6楼
2、7楼

热点排行