This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: link error: undefined reference
- From: Keith <keith at rhsdplanning dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: java at gcc dot gnu dot org
- Date: Thu, 01 Apr 2010 15:07:38 -0500
- Subject: Re: link error: undefined reference
- References: <4BABA6A1.4020404@rhsdplanning.com> <4BACE60D.9080103@rhsdplanning.com> <17c6771e1003260954q21babf04v1f4f22139c692d94@mail.gmail.com> <4BB24285.40204@rhsdplanning.com> <4BB2FDDB.4000405@redhat.com>
Thank you very much. I feel like an idiot. Obviously I've been away from
gcc too long and forgot to keep my compile flags consistent.
Just FYI, compiling under Windows XP, SP3, using gcj 4.4.0, mingw, and msys
When I compile with -O0 -m32 -fjni -findirect-dispatch
using gcj 4.4.0, I get
gcj: unrecognized option '-s-bc-abi'
for some files. It seems to do no harm.
$ cat Test.java
class Test {
public static void main(String[] args)
{
System.out.println("Sample message");
}
}
$ sh -x make-test.sh
+ C_FLAGS='-O0 -m32 -findirect-dispatch'
+ gcj -O0 -m32 -findirect-dispatch -C Test.java
gcj.exe: unrecognized option '-s-bc-abi'
+ gcj -O0 -m32 -findirect-dispatch -o Test.exe Test.class --main=Test
-Wl,--enable-auto-import
$ ./Test.exe
Simple message
$ sh -x make-test.sh
+ C_FLAGS='-O0 -m32'
+ gcj -O0 -m32 -C Test.java
+ gcj -O0 -m32 -o Test.exe Test.class --main=Test -Wl,--enable-auto-import
$ ./Test.exe
This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information.
Andrew Haley wrote:
On 30/03/10 19:27, Keith wrote:
Environment is Windows XP, gcj 4.4.0, compiling under MSYS
The final error I have is:
C:\DOCUME~1\Keith\LOCALS~1\Temp\ccXVrvPx.o:cc8hZGFd.i:(.text+0x29):
undefined reference to `com::performanceplanningsystem::ui::PPS::class$'
collect2: ld returned 1 exit status
This is because you're mixing -findirect-dispatch and
-fno-indirect-dispatch, which doesn't work. Compile the executable
with -findirect-dispatch too.
Andrew.