Thread: [Java-gnome-developer] Help me compile a Glade based app natively with GCJ
Brought to you by:
afcowie
From: Spyros S. <fou...@gm...> - 2005-11-02 16:44:05
|
Hi, I am trying to compile a simple app, which uses Glade with GCJ (GCC ver. 3.3.5 on SuSE 9.3). So I type: gcj -classpath /usr/share/java/gtk2.4.jar:/usr/share/gnome2.8.jar:/usr/share/java/glade2.8= .jar -lgtkjar2.4 -lgnomejar2.8 -lgladejar2.8 --main=3DMain -o Main Main.java What I get as a result is: /tmp/ccYlRfbE.o(.text+0x30): In function `main': ccADRhVT.i: undefined reference to `Main::class$' collect2: ld returned 1 exit status I do not have a clue on what to do from that point. It seems like a linker error (correct me if I am wrong). Do you have any ideas on what to do? Thanx in advance, Spyros "Foucault" Stathopoulos |
From: Adam J. <ajo...@re...> - 2005-11-02 16:53:37
|
Spyros, You're right, this is a linker error. Try adding ':/.' to the end of your classpath and see if that helps. Adam Spyros Stathopoulos wrote: > Hi, > I am trying to compile a simple app, which uses Glade with GCJ (GCC > ver. 3.3.5 on SuSE 9.3). > So I type: > > gcj -classpath > /usr/share/java/gtk2.4.jar:/usr/share/gnome2.8.jar:/usr/share/java/glade2.8.jar > -lgtkjar2.4 -lgnomejar2.8 -lgladejar2.8 --main=Main -o Main Main.java > > What I get as a result is: > > /tmp/ccYlRfbE.o(.text+0x30): In function `main': > ccADRhVT.i: undefined reference to `Main::class$' > collect2: ld returned 1 exit status > > I do not have a clue on what to do from that point. It seems like a > linker error (correct me if I am wrong). > Do you have any ideas on what to do? > > Thanx in advance, > Spyros "Foucault" Stathopoulos > > > |
From: Spyros S. <fou...@gm...> - 2005-11-02 17:59:35
|
Adam, Thank you for your answer however, adding :/. to the end of classpath, so that the command looks like: gcj -classpath /usr/share/java/gtk2.4.jar:/usr/share/gnome2.8.jar:/usr/share/java/glade2.8= .jar:/. -lgtkjar2.4 -lgnomejar2.8 -lgladejar2.8 --main=3DMain -o Main Main.java yields the same result again. /tmp/ccYlRfbE.o(.text+0x30): In function `main': ccADRhVT.i: undefined reference to `Main::class$' collect2: ld returned 1 exit status Spyros "Foucault" Stathopoulos On 11/2/05, Adam Jocksch <ajo...@re...> wrote: > > Spyros, > > You're right, this is a linker error. Try adding ':/.' to the end of > your classpath and see if that helps. > > Adam > > Spyros Stathopoulos wrote: > > > Hi, > > I am trying to compile a simple app, which uses Glade with GCJ (GCC > > ver. 3.3.5 on SuSE 9.3). > > So I type: > > > > gcj -classpath > > > /usr/share/java/gtk2.4.jar:/usr/share/gnome2.8.jar:/usr/share/java/glade2= .8.jar > > -lgtkjar2.4 -lgnomejar2.8 -lgladejar2.8 --main=3DMain -o Main Main.java > > > > What I get as a result is: > > > > /tmp/ccYlRfbE.o(.text+0x30): In function `main': > > ccADRhVT.i: undefined reference to `Main::class$' > > collect2: ld returned 1 exit status > > > > I do not have a clue on what to do from that point. It seems like a > > linker error (correct me if I am wrong). > > Do you have any ideas on what to do? > > > > Thanx in advance, > > Spyros "Foucault" Stathopoulos > > > > > > > > |
From: Tom T. <tr...@re...> - 2005-11-02 17:46:51
|
>>>>> "Spyros" == Spyros Stathopoulos <fou...@gm...> writes: Spyros> gcj -classpath Spyros> /usr/share/java/gtk2.4.jar:/usr/share/gnome2.8.jar:/usr/share/java/glade2.8.jar Spyros> -lgtkjar2.4 -lgnomejar2.8 -lgladejar2.8 --main=Main -o Main Main.java Spyros> /tmp/ccYlRfbE.o(.text+0x30): In function `main': Spyros> ccADRhVT.i: undefined reference to `Main::class$' Spyros> collect2: ld returned 1 exit status Most frequently this error occurs because 'Main' is not the fully qualified name of the class containing the 'main' method. In this case it looks like it is though... but just to be sure, does Main.java have a 'package' statement in it? Tom |
From: Spyros S. <fou...@gm...> - 2005-11-02 21:14:00
|
Hi, again I think I've found smth here: The Main.java class contains the package declaration package org.test; When removing it, it seems to compile fine. When put back the linker produces the same error. Is there a way to keep the package declaration? Spyros "Foucault" Stathopoulos On 11/2/05, Spyros Stathopoulos <fou...@gm...> wrote: > > Adam, > > Thank you for your answer however, adding :/. to the end of classpath, so > that the command looks like: > > gcj -classpath > /usr/share/java/gtk2.4.jar:/usr/share/gnome2.8.jar:/usr/share/java/glade2= .8.jar:/. > -lgtkjar2.4 -lgnomejar2.8 -lgladejar2.8 --main=3DMain -o Main Main.java > yields the same result again. > > /tmp/ccYlRfbE.o(.text+0x30): In function `main': > ccADRhVT.i: undefined reference to `Main::class$' > collect2: ld returned 1 exit status > > Spyros "Foucault" Stathopoulos > > On 11/2/05, Adam Jocksch <ajo...@re...> wrote: > > > > Spyros, > > > > You're right, this is a linker error. Try adding ':/.' to the end of > > your classpath and see if that helps. > > > > Adam > > > > Spyros Stathopoulos wrote: > > > > > Hi, > > > I am trying to compile a simple app, which uses Glade with GCJ (GCC > > > ver. 3.3.5 on SuSE 9.3). > > > So I type: > > > > > > gcj -classpath > > > > > /usr/share/java/gtk2.4.jar:/usr/share/gnome2.8.jar:/usr/share/java/glad= e2.8.jar > > > -lgtkjar2.4 -lgnomejar2.8 -lgladejar2.8 --main=3DMain -o Main Main.ja= va > > > > > > What I get as a result is: > > > > > > /tmp/ccYlRfbE.o(.text+0x30): In function `main': > > > ccADRhVT.i: undefined reference to `Main::class$' > > > collect2: ld returned 1 exit status > > > > > > I do not have a clue on what to do from that point. It seems like a > > > linker error (correct me if I am wrong). > > > Do you have any ideas on what to do? > > > > > > Thanx in advance, > > > Spyros "Foucault" Stathopoulos > > > > > > > > > > > > > > |
From: Anthony G. <gr...@re...> - 2005-11-02 21:20:52
|
On Wed, 2005-11-02 at 23:13 +0200, Spyros Stathopoulos wrote: > Hi, again > > I think I've found smth here: > The Main.java class contains the package declaration > > package org.test; > > When removing it, it seems to compile fine. When put back the linker > produces the same error. Is there a way to keep the package > declaration? Use --main=org.test.Main instead of just --main=Main. This is a common error. AG |
From: Andrew C. <an...@op...> - 2005-11-03 02:56:58
|
On Wed, 2005-02-11 at 13:20 -0800, Anthony Green wrote: > Use --main=org.test.Main instead of just --main=Main. This is a common > error. ... along with forgetting to put the class in a subdirectory matching its package declaration (Spyros, if you want to keep the package statement, then Main.java has to be in ./org/test assuming . is on your classpath) AfC Bangalore |
From: Spyros S. <fou...@gm...> - 2005-11-03 17:09:13
|
Hi Anthony, you were right, I should have used the full path org.test.Main. I should have thought that it was going to be a stupid mistake. Thank you (and everybody) for your kind help Spyros "Foucault" Stathopoulos On 11/2/05, Anthony Green <gr...@re...> wrote: > > On Wed, 2005-11-02 at 23:13 +0200, Spyros Stathopoulos wrote: > > Hi, again > > > > I think I've found smth here: > > The Main.java class contains the package declaration > > > > package org.test; > > > > When removing it, it seems to compile fine. When put back the linker > > produces the same error. Is there a way to keep the package > > declaration? > > Use --main=3Dorg.test.Main instead of just --main=3DMain. This is a commo= n > error. > > AG > > > |
From: Andrew O. <ove...@re...> - 2005-11-02 21:32:09
|
Hi, * Spyros Stathopoulos <fou...@gm...> [2005-11-02 11:44]: > > gcj -classpath > /usr/share/java/gtk2.4.jar:/usr/share/gnome2.8.jar:/usr/share/java/glade2.8.jar > -lgtkjar2.4 -lgnomejar2.8 -lgladejar2.8 --main=Main -o Main Main.java > > What I get as a result is: > > /tmp/ccYlRfbE.o(.text+0x30): In function `main': > ccADRhVT.i: undefined reference to `Main::class$' > collect2: ld returned 1 exit status Perhaps add . to the classpath (ie. -classpath <blah>:.)? Andrew |