public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcj does not compile Hello World
@ 2002-06-07  8:50 wadedl
  2002-06-08 13:23 ` Michael Still
  0 siblings, 1 reply; 3+ messages in thread
From: wadedl @ 2002-06-07  8:50 UTC (permalink / raw)
  To: gcc-help


Dear GNU HELP;

  I built gcc 3.1 using GNU 3.0.4 on my Solaris 2.6 system. I used the
configure flags for GNU as and GNU ld. I do not have dejagnu configured,
but prelim tests demonstrate gcc, g++ and g77 work. When I tried to
compile a simple java program I get the errors shown. The script of my
compile, showing the errors, is:

Script started on Fri Jun 07 08:42:25 2002
gaws20> hostname
gaws20
gaws20> uname -a
SunOS gaws20 5.6 Generic_105181-23 sun4m sparc SUNW,SPARCstation-20
gaws20> date
Fri Jun  7 08:42:32 PDT 2002
gaws20> env | grep CLASS
CLASSPATH=/usr/local/gnu/share/java/libgcj-3.1.jar
gaws20> gcj -o HelloWorld HelloWorld.java
/usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.1/crt1.o: In function `.nope':
/usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.1/crt1.o(.text+0x5c): undefined reference to `main'
collect2: ld returned 1 exit status
gaws20> exit
gaws20> 
script done on Fri Jun 07 08:42:59 2002


What is going on and how can I fix gcj?

Yours Truly,
David L. Wade

**********************************************************************
David L. Wade                                EMail: David.Wade@gat.com
Senior Systems Programmer Analyst                     Ph. 858-455-3342
General Atomics                                       Fx. 858-455-2692
3550 General Atomics Court                San Diego, California  92121     
**********************************************************************
opinions, conclusions, or recommendations expressed above are my own
and do not necessarily represent the views of my employer.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gcj does not compile Hello World
  2002-06-07  8:50 gcj does not compile Hello World wadedl
@ 2002-06-08 13:23 ` Michael Still
  2002-06-08 16:06   ` Bjoern Olav Ringstad
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Still @ 2002-06-08 13:23 UTC (permalink / raw)
  To: wadedl; +Cc: gcc-help

On Fri, 7 Jun 2002 wadedl@gat.com wrote:

> gaws20> gcj -o HelloWorld HelloWorld.java
> /usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.1/crt1.o: In function `.nope':
> /usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.1/crt1.o(.text+0x5c): undefined reference to `main'
> collect2: ld returned 1 exit status

What does the source for your Java program look like?

Mikal

-- 

Michael Still (mikal@stillhq.com)     UMT+10hrs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gcj does not compile Hello World
  2002-06-08 13:23 ` Michael Still
@ 2002-06-08 16:06   ` Bjoern Olav Ringstad
  0 siblings, 0 replies; 3+ messages in thread
From: Bjoern Olav Ringstad @ 2002-06-08 16:06 UTC (permalink / raw)
  To: gcc-help

Hi

When you compile a java program with gcj you have to create a .class file with
gcc -C HelloWorld.java (capital c) and run it with a JVM.
If you need to, you can create a native executable with gcj, then you have to specify
the class that holds the main method like this: gcj -o HelloWorld HelloWorld.java --main=MyClass

--

Bjørn Olav Ringstad (bjornor@stud.cs.uit.no)


> On Fri, 7 Jun 2002 wadedl@gat.com wrote:
> 
> > gaws20> gcj -o HelloWorld HelloWorld.java
> > /usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.1/crt1.o: In function `.nope':
> > /usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.1/crt1.o(.text+0x5c): undefined reference to `main'
> > collect2: ld returned 1 exit status

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-06-08 23:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-07  8:50 gcj does not compile Hello World wadedl
2002-06-08 13:23 ` Michael Still
2002-06-08 16:06   ` Bjoern Olav Ringstad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).