Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help, Error Creating .DLL from .c with Visual C++ Command Line

843829Jan 13 2006 — edited Mar 8 2006
Im trying to do the Java Sun "Hello World" example:

http://java.sun.com/docs/books/jni/html/start.html

Ive never used the Visual Studio c++ compiler with the "cl.exe"
command line program it has.
The command given in the example is:

cl -Ic:\java\include -Ic:\java\include\win32 -MD -LD HelloWorld.c -FeHelloWorld.dll

i had to include the right paths so i entered the command below.

The error i get is:
LINK : fatal error LNK1104: cannot open file "MSVCRT.lib"

Which i tried to fix by adding a library path to:
-LIBPATH:"C:\Program Files\Microsoft Visual Studio\VC98\Lib"
in many different ways.
i dont really know the flag for "libpath" so i tried a bunch of different
ways. viewing the cl.exe -? help options didnt provide much help.

Does anyone know how i can get this to work?
Thanks!



-------------------------------------------------------------------------------------

C:\G\Java\JNI\HW>
"C:\Program Files\Microsoft Visual Studio\VC98\Bin\cl.exe"
-Ic: \j2sdk1.4.2_07\include -Ic:\j2sdk1.4.2_07\include\win32
-I"C:\Program Files\Microsoft Visual Studio\VC98\Include"
-LIBPATH"C:\Program Files\Microsoft Visual Studio\VC98\Lib"
-MD
-LD
HelloWorld.c
-FeHelloWorld.dll

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

Command line warning D4002 : ignoring unknown option '-LIBPATHC:\Program Files\M
icrosoft Visual Studio\VC98\Lib'
HelloWorld.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/dll
/implib:HelloWorld.lib
/out:HelloWorld.dll
HelloWorld.obj
LINK : fatal error LNK1104: cannot open file "MSVCRT.lib"
-------------------------------------------------------------------------------------------
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 5 2006
Added on Jan 13 2006
5 comments
393 views