I do not understand the following error code while I am linking the obj files. I get this error:

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

Can someone please explain to me what went wrong?
Posted on 2002-05-15 08:09:51 by roticv
It may be the case that:
a) The file has been deleted by accident, check this first.
b) There is a drive issue, if you've installed masm32 on a different drive from the source code you are assembling.

If (b) is the problem, qualify the lib with the drive too
e.g. includelib "C:\masm32\lib\kernel.lib"

Mirno
Posted on 2002-05-15 08:38:36 by Mirno
your problem is probably you're linking kernel.lib when you should
be linking kernel32.lib .

Also, may I suggest using relative paths?
includelib <kernel32.lib>
and set up your "lib=" environment variable properly.
Posted on 2002-05-15 08:45:40 by f0dder
if i comment some code like CreateCompatibleDC() i would not get the error... Anyone knows wat went wrong?
Posted on 2002-05-15 09:52:52 by roticv
Rather interestingly MASM searches the included libs in the order they are specified (or so it would seem).
If all outstanding functions are satisfied with earlier includelib directives, faux includelibs (such as those for files which don't exist) are ignored (i.e. cause no error message).

So it would seem that the lib you've specified does not exist (and as f0dder correctly points out, it is most likely meant to be "kernel32.lib" rather than "kernel.lib").

The symptom you describe "fixing" the problem by eliminating a function call is likely to be because it is the only call made to kernel32.dll code hence eliminating the outstanding undefined linker symbol.
If you move "kernel.lib" to the top of your includelib list, it will most likely fail whether or not you comment out the code (as the linker will be directed to look to a file which does not exist first, rather than last where chances are it isn't need at all).
And indeed if you change it to "kernel32.lib" as f0dder suggests you will pick up the correct (and existant) lib file, and solve the problem altogether.

Mirno
Posted on 2002-05-15 10:44:29 by Mirno
I get your point, I just typed wrongly... a common newbie mistake :grin:
Posted on 2002-05-19 09:16:16 by roticv