WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Sponsors
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
What is FASM G
Hard Drive Recovery
Wiring your own LAN
Personal menu
Welcome Guest
User:
Pass:
Register!
Resend Validation Email
 
Forum
 

Simple MessageBox Program Geting Linking Error, Cannot find libary cannot understand why

VictorM
Quote Post


New Member
*

Group: Members
Posts: 8
Member No.: 52284
Joined: 21-June 12


Hello I'm working on a messagebox program but running into linking errors. Here is the code: I am using MASM from WinASM. It does not make any difference if using the full path to the library.

CODE


includelib user32.lib
includelib kernel32.lib
include user32.inc
include kernel32.inc

.MODEL small, stdcall

.STACK 100H
.DATA

Text1 DB  'Hello World!', 0
     Text2 DB  'Message Title', 0

.386  
.CODE

main  PROC

mov  ax,@data  ; Get the address of the data segment
mov  ds,ax  ; Set the DS segment

push 0
push offset Text1
push offset Text2
push 0

call MessageBox

main ENDP
END    main


Microsoft ® Segmented Executable Linker Version 5.60.339 Dec 5 1994
Copyright © Microsoft Corp 1984-1993. All rights reserved.

Object Modules [.obj]: E:\DEVS\Projects\Assembly\DosExe\DosExeV2.objj
LINK : warning L4051: user32.lib : cannot find library
Enter new file spec: LINK : warning L4051: kernel32.lib : cannot find library
Enter new file spec:
E:\DEVS\Projects\Assembly\DosExe\DosExeV2.obj(E:\DEVS\Projects\Assembly\DosExe\DosExeV2.asm) : error L2029: '_MessageBoxA@16' : unresolved external


There was 1 error detected

Sponsored Links
PMEmail Poster
Top
shoorick
Quote Post


Extremely Active Member
******

Group: Admins
Posts: 2342
Member No.: 160
Joined: 22-June 04


at first you made a win32 project with dos template, which uses dos version of linker.

create new empty win32 project, and paste there this code:
CODE
.386  
.MODEL flat, stdcall

includelib user32.lib
includelib kernel32.lib
include user32.inc
include kernel32.inc


.DATA

Text1 DB  'Hello World!', 0
    Text2 DB  'Message Title', 0

.CODE

main  PROC

push 0
push offset Text1
push offset Text2
push 0

call MessageBox

ret

main ENDP
END    main


++++++++++++++++

also, if you see while building the errors kinda "can not find file" check if you did all written in Programming Quick Start
PMEmail PosterUsers Website
Top
VictorM
Quote Post


New Member
*

Group: Members
Posts: 8
Member No.: 52284
Joined: 21-June 12


Many thanks your changes to the code and a new project are working now.

PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian
Google