Jane Vincent
Jane Vincent

Reputation: 11

fatal error LNK1104: cannot open file 'kernel32.lib' in assembly

I am trying to write my first assembly language, "Hello World", but I keep on getting this error that says:

fatal error LNK1104: cannot open file 'kernel32.lib'

Did I install the linker wrong or is there anything wrong with my code? here 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\lib\kernel32.lib
includelib \masm32\lib\masm32.lib

.data

    HelloWorld db "Hello World!", 0

.code
start:

    invoke StdOut, addr HelloWorld
    invoke ExitProcess, 0

end start

Upvotes: 1

Views: 4348

Answers (3)

Vicky Dx
Vicky Dx

Reputation: 23

im running masm32 on windows 10 and this code linked perfectly just needed to include some library

.486                         
.model flat, stdcall                   
option casemap :none                    

include \masm32\include\windows.inc     
include \masm32\macros\macros.asm       

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

.data

HelloWorld db "Hello World!", 0

.code start:

invoke StdOut, addr HelloWorld
invoke ExitProcess, 0

end start

Upvotes: 1

m4ksum
m4ksum

Reputation: 11

Try this in cmd in the C:\masm32\bin folder:

link /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\lib  file.obj

Upvotes: 1

Yasser Gersy
Yasser Gersy

Reputation: 103

try to save the project files in the same directory containing the assemler

Upvotes: 0

Related Questions