Re: link error: undefined reference
Keith <[email protected]>
| Newsgroups | gmane.comp.gcc.java.devel |
|---|---|
| Message-ID | <[email protected]> |
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.
>
>
>