• Post Reply Bookmark Topic Watch Topic
  • New Topic

Undefined Reference Trying to invoke Java from C++  RSS feed

Ranch Hand
Posts: 492
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to create a Java virtual machine from C++ and invoke the main method passing a String argument to the main method of the Java program. I am following this example found on Sun's website: http://java.sun.com/docs/books/jni/html/invoke.html#11202

Here is the simple Java Program:

Here is the C++ program I am using to (try to) invoke the JVM:

Anyway If I just compile the file with:

It compiles fine, but when I try to compile and link:

I get two weird errors that I don't understand:

TestJNIInvoke.cpp:18: undefined reference to `operator new[](unsigned int)'
TestJNIInvoke.cpp:26: undefined reference to `_imp__JNI_CreateJavaVM@12'
collect2: ld returned 1 exit status

I marked the lines in the above code where the error is occuring, has anyone encountered this problem before?

Any ideas/links would be great


Also posted here: http://stackoverflow.com/questions/7547206/undefined-reference-trying-to-invoke-java-from-c
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!