gcjh, Headers hierarchy and namespaces
Michael Koch
konqueror@gmx.de
Tue Jul 20 11:55:00 GMT 2004
Am Dienstag, 20. Juli 2004 13:40 schrieb Florian Bourgier:
> Ok thanks now it finds the headers but compling is ok but not
> linking with the following code (which is not using my headers and
> my library) i got an error :
>
> #include <iostream>
> #include <java/lang/String.h>
> #include <gcj/array.h>
> #include <gcj/cni.h>
> #include <gnu/gcj/RawData.h>
> #include <java/lang/System.h>
> using namespace std;
>
> int main()
> {
> std::string cppstr("Hello, C++ String");
> jstring jstr = JvNewStringUTF(cppstr.c_str());
> //::java::lang::System::out->println(jstr);
> cout << jstr;
> }
>
> Here what I get with > g++ Exemple.c -o Exemple.exe
>
> /cygdrive/c/DOCUME~1/FBOURG~1/LOCALS~1/Temp/ccey63Ls.o(.text+0x34):
>Exemple.c: und
> efined reference to `___gcj_personality_sj0'
> /cygdrive/c/DOCUME~1/FBOURG~1/LOCALS~1/Temp/ccey63Ls.o(.text$_Z14Jv
>NewStringUTFPK c+0xd):Exemple.c: undefined reference to
> `__Jv_NewStringUTF' collect2: ld returned 1 exit status
>
> I tried to specify -Llibgch or -Llibjava but none of them is
> changing anything.
>
> What can i do ? Thanks
If you link with g++ you need to add "-lgcj"
Michael
More information about the Java
mailing list