CNI
Per Bothner
per@bothner.com
Thu Jan 10 16:58:00 GMT 2002
> but when I've compiled this code in Linux by giving
> c++ First.c
>> it is giving me error like
> /tmp/ccMXgkFb.o(.test+0x7) Undefined reference to java::long::Math::random()
First, you need to link with the gcj run-time library.
I suggest using gcj to link, even though you use c++ to compile:
c++ -c First.c
gcj -o First First.o ... other code and options ...
Secondly, if the main program is a C++ program, you need to
initialize the JVM first, by calling JcCreateJavaVM, and
probably JvAttachCurrentThread.
Thirdly, you're skirting into areas that are relatively new and
untested (not to say complex and undocumented), yet you're asking
beginner questions. Perhaps this is not something you should try.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
More information about the Java
mailing list