Prev: ANSWERS
Next: Linux X demo
From: Brian on
Hello all,

I'm a newbie with Masm and assembly in general, and up to now I've been
letting Visual Studio handle the assembly and linking of my projects (using
tweaks to VS supplied by the author of my book on MASM).

Now I'm trying the command line and I can't produce an executable.  I keep
getting linker fatal error LNK1181: cannot open input file 'kernel32.lib'.

kernel32 is in my path statemnt (it's physically in the SDK folder under
MSVS 8), and I don't have the same errors when Visual studio links.

here's my link statement, which is run from the c:\asmtemp folder, where
main.obj resides:

link /OUT:"C:\asmtemp\walk.exe" /NOLOGO /LIBPATH:"C
\Irvine" /MANIFEST /MANIFESTFILE:"C
\asmtemp\walk.exe.intermed.manifest" /DEBUG /PDB:
"C:\asmtemp\walk.pdb" /MAP:"C
\asmtemp\walk.map" /SUBSYSTEM:CONSOLE /ERRORREPORT:NONE user32.Lib
irvine32.lib kernel32.lib main.obj

error produced:
LINK : fatal error LNK1181: cannot open input file 'kernel32.lib'

Any help is appreciated!
--
thanks, Brian
- reply to newsgroup
From: Evenbit on
On Jun 2, 12:39 am, Brian
<stringchopperREMOVEALLC...(a)REMOVEALLCAPSgmail.com> wrote:
> Hello all,
>
> I'm a newbie with Masm and assembly in general, and up to now I've been
> letting Visual Studio handle the assembly and linking of my projects (using
> tweaks to VS supplied by the author of my book on MASM).
>
> Now I'm trying the command line and I can't produce an executable. I keep
> getting linker fatal error LNK1181: cannot open input file 'kernel32.lib'.
>
> kernel32 is in my path statemnt (it's physically in the SDK folder under
> MSVS 8), and I don't have the same errors when Visual studio links.
>
> here's my link statement, which is run from the c:\asmtemp folder, where
> main.obj resides:
>
> link /OUT:"C:\asmtemp\walk.exe" /NOLOGO /LIBPATH:"C
> \Irvine" /MANIFEST /MANIFESTFILE:"C
> \asmtemp\walk.exe.intermed.manifest" /DEBUG /PDB:
> "C:\asmtemp\walk.pdb" /MAP:"C
> \asmtemp\walk.map" /SUBSYSTEM:CONSOLE /ERRORREPORT:NONE user32.Lib
> irvine32.lib kernel32.lib main.obj
>
> error produced:
> LINK : fatal error LNK1181: cannot open input file 'kernel32.lib'
>
> Any help is appreciated!

I would delete everything that says "MANIFEST" and ".manifest" and
".pdb" and ".map" -- that is just junk! It should be something like:

link /OUT:"C:\asmtemp\walk.exe" /NOLOGO /LIBPATH:"C:\Irvine\" /DEBUG /
SUBSYSTEM:CONSOLE user32.lib irvine32.lib kernel32.lib C:\asmtemp
\main.obj

You can find some easy-to-read docs at the bottom of this page:
http://webster.cs.ucr.edu/Page_TechDocs/index.html

Then read the newer stuff here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vcoriMicrosoftAssemblerMacroLanguage.asp

Nathan.

From: Brian on
Evenbit wrote:

> On Jun 2, 12:39 am, Brian
> <stringchopperREMOVEALLC...(a)REMOVEALLCAPSgmail.com> wrote:
>> Hello all,
>>
>> I'm a newbie with Masm and assembly in general, and up to now I've been
>> letting Visual Studio handle the assembly and linking of my projects
>> (using tweaks to VS supplied by the author of my book on MASM).
>>
>> Now I'm trying the command line and I can't produce an executable. I
>> keep getting linker fatal error LNK1181: cannot open input file
>> 'kernel32.lib'.
>>
>> kernel32 is in my path statemnt (it's physically in the SDK folder under
>> MSVS 8), and I don't have the same errors when Visual studio links.
>>
>> here's my link statement, which is run from the c:\asmtemp folder, where
>> main.obj resides:
>>
>> link /OUT:"C:\asmtemp\walk.exe" /NOLOGO /LIBPATH:"C
>> \Irvine" /MANIFEST /MANIFESTFILE:"C
>> \asmtemp\walk.exe.intermed.manifest" /DEBUG /PDB:
>> "C:\asmtemp\walk.pdb" /MAP:"C
>> \asmtemp\walk.map" /SUBSYSTEM:CONSOLE /ERRORREPORT:NONE user32.Lib
>> irvine32.lib kernel32.lib main.obj
>>
>> error produced:
>> LINK : fatal error LNK1181: cannot open input file 'kernel32.lib'
>>
>> Any help is appreciated!
>
> I would delete everything that says "MANIFEST" and ".manifest" and
> ".pdb" and ".map" -- that is just junk! It should be something like:
>
> link /OUT:"C:\asmtemp\walk.exe" /NOLOGO /LIBPATH:"C:\Irvine\" /DEBUG /
> SUBSYSTEM:CONSOLE user32.lib irvine32.lib kernel32.lib C:\asmtemp
> \main.obj
>
> You can find some easy-to-read docs at the bottom of this page:
> http://webster.cs.ucr.edu/Page_TechDocs/index.html
>
> Then read the newer stuff here:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vcoriMicrosoftAssemblerMacroLanguage.asp
>
> Nathan.


Thanks Nathan. I didn't see any references to "link.exe" with either
hyperlink above - did you have a particular article in mind at Randy's
Site?

I got a response in a web forum that said to add a second /LIBPATH option,
pointing to /LIBPATH:"C:\Program Files\Microsoft Visual Studio 8\VC\Lib".

That did the trick. But now I'm wondering why my system path statement,
which includes "C:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\Lib" didn't work ??? There is a kernel32.lib in that
directory as well. any thoughts??

--
thanks, Brian
- reply to newsgroup
From: Frank Kotler on
Brian wrote:

....
> I got a response in a web forum that said to add a second /LIBPATH option,
> pointing to /LIBPATH:"C:\Program Files\Microsoft Visual Studio 8\VC\Lib".
>
> That did the trick. But now I'm wondering why my system path statement,
> which includes "C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\Lib" didn't work ??? There is a kernel32.lib in that
> directory as well. any thoughts??

I don't think the linker searches "PATH". Try putting that directory in
another environment variable. I'd start with "LIB" and experiment (or
RTFM). Maybe "LIBPATH" as an environment variable would do it, but I'm
thinking "LIB" or "LIBS" or "LIBRARY"...

Best,
Frank
From: Brian on
Frank Kotler wrote:

> Brian wrote:
>
> ...
>> I got a response in a web forum that said to add a second /LIBPATH
>> option, pointing to /LIBPATH:"C:\Program Files\Microsoft Visual Studio
>> 8\VC\Lib".
>>
>> That did the trick. But now I'm wondering why my system path statement,
>> which includes "C:\Program Files\Microsoft Visual Studio
>> 8\VC\PlatformSDK\Lib" didn't work ??? There is a kernel32.lib in that
>> directory as well. any thoughts??
>
> I don't think the linker searches "PATH". Try putting that directory in
> another environment variable. I'd start with "LIB" and experiment (or
> RTFM). Maybe "LIBPATH" as an environment variable would do it, but I'm
> thinking "LIB" or "LIBS" or "LIBRARY"...
>
> Best,
> Frank


good tip, thanks
--
thanks, Brian
- reply to newsgroup
 |  Next  |  Last
Pages: 1 2
Prev: ANSWERS
Next: Linux X demo