LINK : fatal error LNK1104: cannot open file "\masm32\lib\kernel32.lib"

Started by Phip, February 26, 2007, 07:35:40 PM

Previous topic - Next topic

Phip

Hello everybody,

I'm new to assembler, so please don't hit me if the question is stupid...

I've a problem with linking my programs (exe and dll), I'm always getting the linker error 1104, "cannot open file "\masm32\lib\kernel32.lib"". Sometimes it works and I can link without trouble, but when it fails once, I have no way to fix it. I think it's debug.lib, because if I comment "includelib <debug.lib>", it works. What can I do to fix this prob?

Here are my commands for assembling, linking and linking dlls (I start them separately in Programmer's Notepad using shortcuts):
Assemble: > "c:\masm32\bin\ml.exe" /c /coff /Cp /Ic:\masm32\include "K:\Phips Files\Developing\Assembler\Parser\Parser.asm"
Link (Doesn't really make sense for a DLL file, but the error is the same): > "c:\masm32\bin\link.exe" /Subsystem:windows /libpath:c:\masm32\lib "K:\Phips Files\Developing\Assembler\Parser\Parser.obj"
Link DLL: > "c:\masm32\bin\link.exe" Parser /Subsystem:windows /libpath:c:\masm32\lib /dll /entry:DllMain /def:"K:\Phips Files\Developing\Assembler\Parser\Parser.def"

When I link the Dll, the full response is this:
> "c:\masm32\bin\link.exe" Parser /Subsystem:windows /libpath:c:\masm32\lib /dll /entry:DllMain /def:"K:\Phips Files\Developing\Assembler\Parser\Parser.def"
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

LINK : fatal error LNK1104: cannot open file "\masm32\lib\kernel32.lib"

> Process Exit Code: 1104
> Time Taken: 00:00

And here's my code (comment the inclusion of kernel32.lib doesn't seem to change anything):
.486
.model flat, stdcall
option casemap:none

include <windows.inc>
include <masm32.inc>
include <macros.asm>
include <debug.inc>
include <kernel32.inc>

includelib <masm32.lib>
;includelib <kernel32.lib>
includelib <debug.lib>

.data
Txt db "It works :)"

.code
Tst proc
PrintString Txt
Tst endp


DllMain proc hInstDll:DWORD, dwNotification:DWORD, lpReserved:DWORD
.if dwNotification == DLL_PROCESS_ATTACH

.elseif dwNotification == DLL_PROCESS_DETACH

.elseif dwNotification == DLL_THREAD_ATTACH

.elseif dwNotification == DLL_THREAD_DETACH

.endif

ret
DllMain endp
end


Thanks for your help!

Phip

hutch--

Get rid of the angle brackets as masm does not normally use them and try adding the full path for the library locations. Check if the library exists.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Phip

Thanks for your answer, but it doesn't work. As you can see in the code, the problem is not my inclusion of kernel32.lib, but the one in debug.lib/debug.inc. I haven't defined a path like "\masm32\lib\kernel32.lib", that stands in debug.lib, but it's not a full path of course. Is it possible to assemble all the libs with the full path?

Phip

ARGH!
I solved it. The problem is that the files aren't on my local hard drive but on my files drive (Check out the paths). Damn error... Is there any possibility to get it working without this issue?

hutch--

If you bothered to rewrite the build files specific to your drives, its possible but the masm32 project installs on a single partition for exactly this reason, it can find everything.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Phip

Well, ok, but where's the difference between locating a file at c:\... and k:\...? I mean, the paths must be correct or everything would fail, but it's only the debug.lib. But ok, it's not really a problem having it installed on another drive... And it doesn't write anything in the registry, does it?