Answer the question
In order to leave comments, you need to log in
Why doesn't assembler compile?
app.obj : error LNK2001: unresolved external symbol [email protected]
app.exe : fatal error LNK1120: 1 unresolved externals
include <\masm32\include\user32.inc>
include <\masm32\include\kernel32.inc>
includelib <\masm32 \lib\user32.lib>
includelib <\masm32\lib\kernel32.lib>
.data
ClassName db "SimpleWinClass",0
AppName db "Our First Window",0 ; For the MessageBox function
hello_mess1 db "Left mouse button pressed",0
hello_mess2 db "Right mouse button pressed",0
hello_title db "Hurrah!",0
.data?
hInstance HINSTANCE ?
hInst HINSTANCE ?
CommandLine LPSTR ?
wc WNDCLASSEX <?>
msg MSG <?>
hwnd HWND ?
.code
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style,CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc,OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInstance
pop wc.hInstance
mov wc.hbrBackground,COLOR_WINDOW+1
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor, eax
invoke RegisterClassEx,addr wc
INVOKE CreateWindowEx,NULL,ADDR ClassName,ADDR AppName, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL, hInst,NULL
mov hwnd,eax
invoke ShowWindow,hwnd,SW_SHOWNORMAL
invoke UpdateWindow,hwnd
MSG_LOOP:
invoke GetMessage,ADDR msg_LOOP: invoke GetMessage,ADDR msg_LOOP: invoke GetMessage,ADDR msg NULL,0,0
cmp eax,0
je END_LOOP
invoke TranslateMessage,ADDR msg
invoke DispatchMessage,ADDR msg
jmp MSG_LOOP
END_LOOP:
mov eax,msg.wParam
invoke ExitProcess,eax
WndProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam :LPARAM
cmp uMsg,WM_DESTROY
je WMDESTROY
cmp uMsg,WM_LBUTTONDOWN
je LBUTTON
cmp uMsg,WM_RBUTTONDOWN
je RBUTTON
JMP DEFWNDPROC
WMDESTROY:
invoke PostQuitMessage,NULL
xor eax,eax
jmp FINISH
LBUTTON:
invoke MessageBoxA,0,addr hello_mess1,addr hello_title,MB_OK
jmp FINISH
RBUTTON:
invoke MessageBoxA,0,addr hello_mess2,addr hello_title,MB_OK
jmp FINISH
DEFWNDPROC:
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
FINISH:
ret WndProc endp
Answer the question
In order to leave comments, you need to log in
I can assume that they forgot to link the library with the implementation of
MessageBox I don’t rummage in ACM, but the problem is familiar from C ++
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question