This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi Michael, Thanks for the reply, I already have compiled SDK in java with me.. I want to call the Java SDK from C++. >gcj -o test test.o test2.o javatest.o Yes , this works . But if I have a lot of classes imported(import org.apache.*;) in my test2.java then do I need to compile all the classes and provide them..Please find here the code below ++++++++++++++++++++++++++++++++++ import temp.test; import com.testPrograme.sdk.framework.*; import com.testPrograme.sdk.exception.*; import com.testPrograme.sdk.infostore.*; import com.testPrograme.sdk.security.*; class test2 { public void CrAdduser() { System.out.println("Test2 class"); test t = new test(); t.func1(); } } +++++++++++++++++++++++++++++++++++++++++++ Thanks, Ranga +++++++++++++++++++++++++++++++++ -----Original Message----- From: Michael Koch [mailto:konqueror@gmx.de] Sent: Tuesday, June 01, 2004 3:50 PM To: java@gcc.gnu.org Cc: Ranga Reddy M - CTD ,Chennai.; gnu@gnu.org; gcc@gcc.gnu.org Subject: Re: GCJ compilation problems -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am Dienstag, 1. Juni 2004 11:47 schrieb Ranga Reddy M - CTD ,Chennai.: > Hi , > > I do not have much idea about the gcj. I started working on it.. > > Could you please let me know about the compilation procedure for > the following programs. > > I am calling java from C++, My C++ programe is here > and java programs(test2.java) has import * statments....(package is > test.java). > > > I am getting the following error if I run the programe as > > >gcj -o Mytest test2.java javatest.cpp -lstdc++ -lgcj > > Undefined first referenced > symbol in file > temp::test::test() /var/tmp//ccEZC6Eg.o > temp::test::class$ /var/tmp//ccEZC6Eg.o > ld: fatal: Symbol referencing errors. No output written to 1 > collect2: ld returned 1 exit status > > But, this works fine except only one warning > > >gcj -o Mytest test2.java test.java javatest.cpp -lstdc++ -lgcj You cant compile C++ code with a Java compiler and you dont need to link libgcj (and libstdc++ too) explicitely because they are implicitely linked. Best is to compile each source file to an object file and then link all together with gcj. g++ -c javatest.cpp gcj -c test2.java gcj -c test.java gcj -o test test.o test2.o javatest.o Thats the easy way most projects to this. Michael - -- Homepage: http://www.worldforge.org/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAvFhEWSOgCCdjSDsRAmP/AJoD+fqLyb/QDPyzGMNzZewGxPbwoQCfeyWw dJxj0JuwKoT45xKvt91BZXY= =/DED -----END PGP SIGNATURE-----
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |