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] | |
On Thu, 2005-11-10 at 14:06 +0100, Julien Claassen wrote:
> Hello all!
> I wanted to compile a helloworld program with selfcompiled gcc-3.4.3 (see
> below for more info). It had linking problems. Compile only works fine.
> The program was:
> // Begin of Test.java
>
> import java.lang.*;
>
> class Test
> {
> public static void main(String args[])
> {
> System.out.println("Hello world.\n");
> }
> };
>
> // EOF
> The gcj call and output was:
> gcj Test.java
>
> /usr/lib/crt1.o: In function `_start':
> /usr/lib/crt1.o(.text+0x18): undefined reference to `main'
> collect2: ld returned 1 exit status
When generating an executable you need it to tell which class is the
main class: gcj --main=Test Test.java
The resulting a.out executable will then start executing your program
using Test.main().
See also http://gcc.gnu.org/onlinedocs/gcj/Linking.html#Linking
Cheers,
Mark
--
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
Join the community at http://planet.classpath.org/
Attachment:
signature.asc
Description: This is a digitally signed message part
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |