public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcj
@ 2004-04-23 15:37 Plapp, Phillip
  0 siblings, 0 replies; 14+ messages in thread
From: Plapp, Phillip @ 2004-04-23 15:37 UTC (permalink / raw)
  To: gcc-help

Hello gnu,

I've been playing around with the CNI from gcj, which I find really
helpful, and have come up with a question.  I have looked over the
documentation, but still cannot answer the question myself so I've
reduced myself to bothering somebody else.  This is not an
emergency.......

In my C++ CNI file I access a java ArrayList which contains several
instances of my class ItemVersionStatistics.

When I enter the line,
	ItemVersionStatistics *ivs = (ItemVersionStatistics)
arrayListVariable->get(0);
The compiler gives the following error message:

ItemTest.cpp: In function `int main(int, char*)':
ItemTest.cpp:643: error: no matching function for call to
`ItemVersionStatistics::ItemVersionStatistics(java::lang::Object*)'
./ItemVersionStatistics.h:33: note: candidates are:
ItemVersionStatistics::ItemVersionStatistics(java
::lang::String*, java::util::Date*, java::util::ArrayList*)

To me it looks like the type cast is being ignored.
What am I doing wrong?

Thanks!
Phillip Plapp





  

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

* Re: gcj
       [not found] <200901181717.n0IHHMOM028799@smtp.google.com>
@ 2009-01-20  1:06 ` Ian Lance Taylor
  0 siblings, 0 replies; 14+ messages in thread
From: Ian Lance Taylor @ 2009-01-20  1:06 UTC (permalink / raw)
  To: Franklyn Simon; +Cc: gcc-help

Franklyn Simon <franklynsimon@bellsouth.net> writes:

> I would like to install gcj with gcc-4.3.2 on SUSE Linix Enterprise
> Server 9 on a i686 machine.
> However, It is not clear where to get gcj.  I am not a developer just a user.

It is normally available in a packaged named gcc-java or something
along those lines.  However, I am not familiar with the package names
used by S.U.S.E. Linux.

Ian

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

* gcj
@ 2009-01-18 17:17 Franklyn Simon
  0 siblings, 0 replies; 14+ messages in thread
From: Franklyn Simon @ 2009-01-18 17:17 UTC (permalink / raw)
  To: gcc-help

Hi,

I would like to install gcj with gcc-4.3.2 on SUSE Linix Enterprise 
Server 9 on a i686 machine.
However, It is not clear where to get gcj.  I am not a developer just a user.

Thx

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

* gcj
@ 2009-01-18 17:17 Franklyn Simon
  0 siblings, 0 replies; 14+ messages in thread
From: Franklyn Simon @ 2009-01-18 17:17 UTC (permalink / raw)
  To: gcc-help

Hi,

I would like to install gcj with gcc-4.3.2 on SUSE Linix Enterprise 
Server 9 on a i686 machine.
However, It is not clear where to get gcj.  I am not a developer just a user.

Thx

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

* gcj
@ 2004-04-27 15:24 Plapp, Phillip
  0 siblings, 0 replies; 14+ messages in thread
From: Plapp, Phillip @ 2004-04-27 15:24 UTC (permalink / raw)
  To: gcc-help

Hello GNU guys,

I have a question concerning GCJ, CNI and nested java classes.  The
following is my java class scenario in
which class A contains an instance of a nested class B:

Class  A
{

   B b;

        Class B
        {
                int getSize();
        }
}

In my CNI style C++ file, I  have the following code that attempts to
access b->getSize() through a, which is an instance of A



#include <A.h>     		// line number 3

A$B *tmp = (A$B*)a.getB;	// line number 180
jint size = tmp->getSize();	// line number 181




When I compile with gcj, I get the following error:
Test.cpp:181: error: invalid use of undefined type 'A$B'

As you can see, the compiler didn't have a problem with line 180 where I
got the instance b of class B.  The problem 
came when I tried to use the instance of b.  I assume this is because
there is no A$B header file.  I tried to produce the 
A$B.h file, but gcjh only produced the A.h file even when I ran 
gcjh A$B.

Any ideas?

You guys make good stuff!
Thanks!
Phil

  

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

* Re: gcj
@ 2004-04-23 15:45 bserdar
  0 siblings, 0 replies; 14+ messages in thread
From: bserdar @ 2004-04-23 15:45 UTC (permalink / raw)
  To: Plapp, Phillip; +Cc: gcc-help

> In my C++ CNI file I access a java ArrayList which contains several
> instances of my class ItemVersionStatistics.
> 
> When I enter the line,
> 	ItemVersionStatistics *ivs = (ItemVersionStatistics)
> arrayListVariable->get(0);

You are typecasting to a ItemVersionStatistics, not to a pointer to it. Try:

ItemVersionStatistics *ivs = (ItemVersionStatistics *)
  arrayListVariable->get(0);


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

* Re: gcj
  1999-11-23  5:43 ` gcj Eric Doenges
@ 1999-11-30 23:28   ` Eric Doenges
  0 siblings, 0 replies; 14+ messages in thread
From: Eric Doenges @ 1999-11-30 23:28 UTC (permalink / raw)
  To: help-gcc

Ashwin Kapur <akapur@bellatlantic.net> writes:

>The java file compiles into an o file but the compiler
>complains about the absence of a main.  The code contains a
>main.  Is there some specific thing I'm supposed to be doing
>to compile and like code with gcj.  Are there docs on this.

try 'gcj --main=EchoClient EchoClient.java -o ...'. Also try to find the
file 'Compiling with GCJ' on the Cygnus website (sorry, I don't have the
URL handy), which describes all the command line options gcj offers.

>Is there some library I'm supposed to link to or something.

This is done automatically if you let gcj do the linking.
-- 
________________________________________________________________________
Dipl.-Ing. Eric Doenges                         http://www.rcs.ei.tum.de
Institute for Real-Time Computer Systems (RCS)      fon +49-89-289-23590
Technische Universitaet Muenchen, D-80290 Muenchen  fax +49-89-289-23555

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

* gcj
  1999-11-23  5:47 gcj Ashwin Kapur
  1999-11-23  5:43 ` gcj Eric Doenges
@ 1999-11-30 23:28 ` Ashwin Kapur
  1 sibling, 0 replies; 14+ messages in thread
From: Ashwin Kapur @ 1999-11-30 23:28 UTC (permalink / raw)
  To: help-gcc

Sorry if this is off topic but I don't see a newsgroup for
gcj specifically and this seems to be the closest one since
it's a compiler specific question.  I'm trying to compile
some java code into a native binary on suse 6.2 using the
gcj in gcc 2.95-2.

The Problem:

The java file compiles into an o file but the compiler
complains about the absence of a main.  The code contains a
main.  Is there some specific thing I'm supposed to be doing
to compile and like code with gcj.  Are there docs on this.

Is there some library I'm supposed to link to or something.

Thanks

Ashwin

Here is the source code.  It is an example from the java
tutorial.  

//---------------------------------------------------------------------
import java.io.*;
import java.net.*;

public class EchoClient {
    public static void main(String[] args) throws
IOException {
	
	Socket echoSocket = null;
	PrintWriter out = null;
	BufferedReader in = null;
	
	try {
	    echoSocket = new Socket("coredump", 7);
	    out = new PrintWriter(echoSocket.getOutputStream(),
true);
	    in = new BufferedReader(new InputStreamReader(
							  echoSocket.getInputStream()));
	} catch (UnknownHostException e) {
	    System.err.println("Don't know about host: coredump");
	    System.exit(1);
	} catch (IOException e) {
	    System.err.println("Couldn't get I/O for "
			       + "the connection to: coredump");
	    System.exit(1);
	}
	
	BufferedReader stdIn = new BufferedReader(
						  new InputStreamReader(System.in));
	String userInput;
	
	while ((userInput = stdIn.readLine()) != null) {
	    out.println(userInput);
	    System.out.println("echo: " + in.readLine());
	}
	
	out.close();
	in.close();
	stdIn.close();
	echoSocket.close();
    }
}
//--------------------------------------------------------------------------

-- 
#include <std_disclaimer>
#include <std_humor>

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

* gcj
@ 1999-11-23  5:47 Ashwin Kapur
  1999-11-23  5:43 ` gcj Eric Doenges
  1999-11-30 23:28 ` gcj Ashwin Kapur
  0 siblings, 2 replies; 14+ messages in thread
From: Ashwin Kapur @ 1999-11-23  5:47 UTC (permalink / raw)
  To: help-gcc

Sorry if this is off topic but I don't see a newsgroup for
gcj specifically and this seems to be the closest one since
it's a compiler specific question.  I'm trying to compile
some java code into a native binary on suse 6.2 using the
gcj in gcc 2.95-2.

The Problem:

The java file compiles into an o file but the compiler
complains about the absence of a main.  The code contains a
main.  Is there some specific thing I'm supposed to be doing
to compile and like code with gcj.  Are there docs on this.

Is there some library I'm supposed to link to or something.

Thanks

Ashwin

Here is the source code.  It is an example from the java
tutorial.  

//---------------------------------------------------------------------
import java.io.*;
import java.net.*;

public class EchoClient {
    public static void main(String[] args) throws
IOException {
	
	Socket echoSocket = null;
	PrintWriter out = null;
	BufferedReader in = null;
	
	try {
	    echoSocket = new Socket("coredump", 7);
	    out = new PrintWriter(echoSocket.getOutputStream(),
true);
	    in = new BufferedReader(new InputStreamReader(
							  echoSocket.getInputStream()));
	} catch (UnknownHostException e) {
	    System.err.println("Don't know about host: coredump");
	    System.exit(1);
	} catch (IOException e) {
	    System.err.println("Couldn't get I/O for "
			       + "the connection to: coredump");
	    System.exit(1);
	}
	
	BufferedReader stdIn = new BufferedReader(
						  new InputStreamReader(System.in));
	String userInput;
	
	while ((userInput = stdIn.readLine()) != null) {
	    out.println(userInput);
	    System.out.println("echo: " + in.readLine());
	}
	
	out.close();
	in.close();
	stdIn.close();
	echoSocket.close();
    }
}
//--------------------------------------------------------------------------

-- 
#include <std_disclaimer>
#include <std_humor>

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

* Re: gcj
  1999-11-23  5:47 gcj Ashwin Kapur
@ 1999-11-23  5:43 ` Eric Doenges
  1999-11-30 23:28   ` gcj Eric Doenges
  1999-11-30 23:28 ` gcj Ashwin Kapur
  1 sibling, 1 reply; 14+ messages in thread
From: Eric Doenges @ 1999-11-23  5:43 UTC (permalink / raw)
  To: help-gcc

Ashwin Kapur <akapur@bellatlantic.net> writes:

>The java file compiles into an o file but the compiler
>complains about the absence of a main.  The code contains a
>main.  Is there some specific thing I'm supposed to be doing
>to compile and like code with gcj.  Are there docs on this.

try 'gcj --main=EchoClient EchoClient.java -o ...'. Also try to find the
file 'Compiling with GCJ' on the Cygnus website (sorry, I don't have the
URL handy), which describes all the command line options gcj offers.

>Is there some library I'm supposed to link to or something.

This is done automatically if you let gcj do the linking.
-- 
________________________________________________________________________
Dipl.-Ing. Eric Doenges                         http://www.rcs.ei.tum.de
Institute for Real-Time Computer Systems (RCS)      fon +49-89-289-23590
Technische Universitaet Muenchen, D-80290 Muenchen  fax +49-89-289-23555

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

* Re: gcj
  1999-10-27 21:52 ` gcj Anthony Green
@ 1999-10-31 13:57   ` Anthony Green
  0 siblings, 0 replies; 14+ messages in thread
From: Anthony Green @ 1999-10-31 13:57 UTC (permalink / raw)
  To: help-gcc

Chris Majewski <majewski@cascade.cs.ubc.ca> writes:

> Anyone seen this before? -chris

It's an FAQ item at 
http://sourceware.cygnus.com/java/faq.html

3.1 Why do I get undefined reference to `main' errors?

    When using gcj to link a Java program, you must use the --main=
    option to indicate the class that has the desired main
    method. This is because every Java class can have a main method,
    thus you have to tell gcj which one to use.

AG

-- 
Anthony Green                                               Cygnus Solutions
                                                       Sunnyvale, California

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

* gcj
  1999-10-27 21:31 gcj Chris Majewski
  1999-10-27 21:52 ` gcj Anthony Green
@ 1999-10-31 13:57 ` Chris Majewski
  1 sibling, 0 replies; 14+ messages in thread
From: Chris Majewski @ 1999-10-31 13:57 UTC (permalink / raw)
  To: help-gcc

Anyone seen this before? -chris

[cascade]21:25:26[helloworld]$ gcj -c HelloWorld.java 
[cascade]21:25:32[helloworld]$ ls
HelloWorld.java   HelloWorld.o
[cascade]21:25:33[helloworld]$ gcj HelloWorld.o
Undefined                       first referenced
 symbol                             in file
main                                /cs/public/generic/lib/pkg/gcc-2.95.1/lib/gcc-lib/sparc-sun-solaris2.6/2.95.1/crt1.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
[cascade]21:25:45[helloworld]$ 

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

* Re: gcj
  1999-10-27 21:31 gcj Chris Majewski
@ 1999-10-27 21:52 ` Anthony Green
  1999-10-31 13:57   ` gcj Anthony Green
  1999-10-31 13:57 ` gcj Chris Majewski
  1 sibling, 1 reply; 14+ messages in thread
From: Anthony Green @ 1999-10-27 21:52 UTC (permalink / raw)
  To: help-gcc

Chris Majewski <majewski@cascade.cs.ubc.ca> writes:

> Anyone seen this before? -chris

It's an FAQ item at 
http://sourceware.cygnus.com/java/faq.html

3.1 Why do I get undefined reference to `main' errors?

    When using gcj to link a Java program, you must use the --main=
    option to indicate the class that has the desired main
    method. This is because every Java class can have a main method,
    thus you have to tell gcj which one to use.

AG

-- 
Anthony Green                                               Cygnus Solutions
                                                       Sunnyvale, California

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

* gcj
@ 1999-10-27 21:31 Chris Majewski
  1999-10-27 21:52 ` gcj Anthony Green
  1999-10-31 13:57 ` gcj Chris Majewski
  0 siblings, 2 replies; 14+ messages in thread
From: Chris Majewski @ 1999-10-27 21:31 UTC (permalink / raw)
  To: help-gcc

Anyone seen this before? -chris

[cascade]21:25:26[helloworld]$ gcj -c HelloWorld.java 
[cascade]21:25:32[helloworld]$ ls
HelloWorld.java   HelloWorld.o
[cascade]21:25:33[helloworld]$ gcj HelloWorld.o
Undefined                       first referenced
 symbol                             in file
main                                /cs/public/generic/lib/pkg/gcc-2.95.1/lib/gcc-lib/sparc-sun-solaris2.6/2.95.1/crt1.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
[cascade]21:25:45[helloworld]$ 

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

end of thread, other threads:[~2009-01-20  1:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-23 15:37 gcj Plapp, Phillip
     [not found] <200901181717.n0IHHMOM028799@smtp.google.com>
2009-01-20  1:06 ` gcj Ian Lance Taylor
  -- strict thread matches above, loose matches on Subject: below --
2009-01-18 17:17 gcj Franklyn Simon
2009-01-18 17:17 gcj Franklyn Simon
2004-04-27 15:24 gcj Plapp, Phillip
2004-04-23 15:45 gcj bserdar
1999-11-23  5:47 gcj Ashwin Kapur
1999-11-23  5:43 ` gcj Eric Doenges
1999-11-30 23:28   ` gcj Eric Doenges
1999-11-30 23:28 ` gcj Ashwin Kapur
1999-10-27 21:31 gcj Chris Majewski
1999-10-27 21:52 ` gcj Anthony Green
1999-10-31 13:57   ` gcj Anthony Green
1999-10-31 13:57 ` gcj Chris Majewski

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).