This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCJ compilation problems
- From: Michael Koch <konqueror at gmx dot de>
- To: java at gcc dot gnu dot org
- Cc: "Ranga Reddy M - CTD ,Chennai." <rangareddym at ctd dot hcltech dot com>, gnu at gnu dot org, gcc at gcc dot gnu dot org
- Date: Tue, 1 Jun 2004 12:19:48 +0200
- Subject: Re: GCJ compilation problems
- References: <53BBBB3235C2C74583722B212B36CA0D65E9AD@vishnu.ctd.hcltech.com>
-----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-----