我正在尝试编写我的第一个汇编语言“Hello World”,但我不断收到这样的错误:
致命错误LNK1104:无法打开文件'kernel32.lib'
我是否安装了错误的链接器或我的代码有什么问题?这是我的代码
.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
答案 0 :(得分:1)
在C:\masm32\bin
文件夹中的cmd中尝试此操作:
link /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\lib file.obj
答案 1 :(得分:1)
我在Windows 10上运行masm32并且此代码完美链接 只需要包含一些库
.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
。数据
HelloWorld db "Hello World!", 0
.CODE 开始:
invoke StdOut, addr HelloWorld
invoke ExitProcess, 0
结束开始
答案 2 :(得分:0)
尝试将项目文件保存在包含assemler
的同一目录中