I am a beginner in assembly. I install masm32..... Getting the .obj file worked perfectly, but when I tried to link it(turn it into .exe file) I got 4 errors. This is my code:.386
.model flat,stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib \masm32\include\kernel32.lib
includelib \masm32\include\masm32.lib
.data
HelloWorld db "Hello World!",0
.code
start:
invoke StdOut, addr HelloWorld
invoke ExitProcess,0
end start
, and here are the errors that I got: `
Hello.obj : warning LNK4033: converting object format from OMF to COFF
Hello.obj : error LNK2001: unresolved external symbol _StdOut@4
Hello.obj : error LNK2001: unresolved external symbol _ExitProcess@4
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
Hello.exe : fatal error LNK1120: 3 unresolved externals
I really don't know what could be the problem, can someone help?
Very close to my code. Maybe it losts on paths.
.386
.MODEL flat, stdcall
OPTION casemap :none
INCLUDE windows.inc
INCLUDE kernel32.inc
INCLUDE masm32.inc
INCLUDELIB kernel32.lib
INCLUDELIB masm32.lib
.DATA
msg DB "Hola mundo, en consola windows.", 0
.CODE
start:
INVOKE StdOut, ADDR msg
INVOKE ExitProcess, 0
END start
Complile with
C:\masm32\bin\ml.exe /c /coff /Cp /IC:\masm32\Include ConWM01.ASM
C:\masm32\bin\link.exe /SUBSYSTEM:CONSOLE /LIBPATH:c:\masm32\lib ConWM01.obj
It works to me :biggrin:
Thank you a lot, I will try that.....
I still get the same errors.....
To see if is working:
- Open qeditor.exe (is in \masm32 )
- Open your file
- replace options and includes with:
include \masm32\include\masm32rt.inc
- in the menu Project > Console Assemble & link
:thumbsup:
includelib \masm32\include\kernel32.lib
includelib \masm32\include\masm32.lib
must be:
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
I still get the same errors.....
As HSE already wrote, includelib must point to the lib, not the include folder. Even better: use masm32rt.inc as shown below (in case you are curious why, open it in Notepad and have a look).
include \masm32\include\masm32rt.inc
.data
HelloWorld db "Hello World!", 0
.code
start:
invoke StdOut, addr HelloWorld
invoke ExitProcess,0
end start
I tried that, but the same thing happened, same 3 errors.....
Is your file in same unit that masm32?
Try to build code in \masm32\examples (with Projects > Buil All if there is not .bat)
I tried moving it to the same dir, the same thing happened.....
Please run the attachment and post the result here.
Delete your exist installation and re-install the masm32 SDK. Try not to install it on drive C: as the OS may interfere.
Once it is installed, try one of the samples in the examples directory. Unless you have changed something OR something is broken in your computer setup, it should be able to build any of the examples.