Hey,firends,This is my first post.
I’m just begin to using Gcc to compile java,and I have some trouble in doing this.
My input and output:
import java.io.*;
import java.util.*;
public class Program{
public static void main (String args[]) throws Exception {
BufferedReader stdin =new BufferedReader(new InputStreamReader(System.in));
String line = stdin.readLine();
StringTokenizer st = new StringTokenizer(line);
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
System.out.println(a+b);
}
}
cmd:gcj Porgram.java
<2>output:
E:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../libmingw32.a:main.c:<.text+0xd2>:undefined reference to ‘_WinMain@16’ collect2: ld returned 1 exit status
Any help would be very much appreciated!!
Gcj neds to be told which of the classes it is compiling contains the main method. You can do this by using the
--maincommand line parameter: