Undefined references for SWT

Marco Trudel mtrudel@gmx.ch
Sun Feb 11 14:09:00 GMT 2007


Harpal Grover wrote:
> Here is my makefile, which shows all of the gcj runtime parameters
> (org.eclipse.swt.windgets.Control is in the swt.jar):
> 
> # Generated by Eclipse GCJ Builder
> # http://gcjbuilder.sf.net
> 
> #global targets
> ALL:    main
> all:    main
> 
> #gcj variable
> GCJ=gcj  $(OPTLEVEL) $(DEBUGLEVEL) $(COMPILER_OPTIONS)
> 
> #binary output folder
> BINOUT= release
> 
> #compiler options
> COMPILER_OPTIONS=
> 
> #linker options
> LINKER_OPTIONS=
> 
> #object list
> OBJ=App.o
> 
> #custom objects
> CUSTOM_OBJ=
> 
> #jar objects
> CPOBJ=$(BINOUT)/./nebula_grid_ALPHA.jar.o
> $(BINOUT)/./gface_0.9.1.jar.o $(BINOUT)/./swt.jar.o
> 
> #jar so
> CPSO=
> 
> #project classpath
> CP="--classpath=C:/projects/java/TSCN/Desktop/lib/h2.jar;C:/projects/java/TSCN/Desktop/lib/nebula_grid_ALPHA.jar;C:/projects/java/TSCN/Desktop/lib/ktable_2.1.3.jar;gface_0.9.1.jar;C:/thisiscool-gcc/swt/win32/3218/swt.jar;./;" 
> 
> 
> #main class (or so output)
> MAINCLASS=--main=App -fjni

I only see -fjni here for the main compilation.


> #binary name (exe or so)
> BIN=$(BINOUT)/scnlm.exe
> 
> #library path list
> LIBRARYPATH=-L$(BINOUT)
> 
> #libraries (so) list
> LIBRARIES=
> 
> #resource objects list
> RESOB=
> 
> #compiler optimization level
> OPTLEVEL= -O3
> 
> #compiler debug level
> DEBUGLEVEL= -g0
> 
> 
> #object targets
> %.o:    %.java
>     $(GCJ) $(CP)  -c $? -o $@

Here -fjni is missing if this compiles swt to an object. But I was too 
lazy to take a close look at this huge (in comparison to some little 
short manual commands which would have been a good alternative) 
makefile. So I might be wrong...


Marco

> ##################
> #dummy targets (depend on config)
> 
> #classpath objects target
> $(BINOUT)/./nebula_grid_ALPHA.jar.o
> :C:/projects/java/TSCN/Desktop/lib/nebula_grid_ALPHA.jar
>     $(GCJ) -c $(CP)
> C:/projects/java/TSCN/Desktop/lib/nebula_grid_ALPHA.jar
> -o$(BINOUT)/nebula_grid_ALPHA.jar.o
> $(BINOUT)/./gface_0.9.1.jar.o :gface_0.9.1.jar
>     $(GCJ) -c $(CP) gface_0.9.1.jar -o$(BINOUT)/gface_0.9.1.jar.o
> $(BINOUT)/./swt.jar.o :C:/thisiscool-gcc/swt/win32/3218/swt.jar
>     $(GCJ) -c $(CP) C:/thisiscool-gcc/swt/win32/3218/swt.jar 
> -o$(BINOUT)/swt.jar.o
> 
> 
> #classpath so target
> 
> 
> #resource objects target
> 
> 
> 
> #################
> 
>     
> #main target
> 
> main: setup $(CPOBJ) $(RESOB) $(OBJ) $(CPSO)
>     $(GCJ) $(LINKER_OPTIONS) $(MAINCLASS) $(CPOBJ) $(CUSTOM_OBJ) $(RESOB)
> $(OBJ) -o$(BIN)   $(LIBRARYPATH) $(LIBRARIES) $(CPSO)
> 
> #setup output folders
> setup:
>     mkdir -p $(BINOUT)/resource
> 
> #clean target
> clean:
>     rm -f `find . -name "*.o"`
>     rm -r $(BINOUT)
> 
> On 2/11/07, Andrew Haley <aph@redhat.com> wrote:
>> Harpal Grover writes:
>>  > Hi,
>>  >
>>  > I am using GCJ for MingW  GCC/GCJ 4.3 (gcj-eclipse-merge-branch).
>>  >
>>  > I am getting the following errors when I attempt to compile not only
>>  > my java code, but referenced jars as well:
>>  >
>>  >
>>  >
>>  > org/vafada/swtcalendar/SWTCalendar.o:SWTCalendar.java:(.data+0xc28):
>>  > undefined reference to
>>  > `org::eclipse::swt::widgets::Control::isActive()'
>>  >
>>  > org/vafada/swtcalendar/SWTCalendar.o:SWTCalendar.java:(.data+0xc2c):
>>  > undefined reference to
>>  > `org::eclipse::swt::widgets::Control::isEnabled()'
>>  >
>>  > org/vafada/swtcalendar/SWTCalendar.o:SWTCalendar.java:(.data+0xc30):
>>  > undefined reference to
>>  > `org::eclipse::swt::widgets::Control::isFocusControl()'
>>  >
>>  > org/vafada/swtcalendar/SWTCalendar.o:SWTCalendar.java:(.data+0xc34):
>>  > undefined reference to
>>  > 
>> `org::eclipse::swt::widgets::Control::isFocusAncestor(org::eclipse::swt::widgets::Control*)' 
>>
>>  >
>>  > org/vafada/swtcalendar/SWTCalendar.o:SWTCalendar.java:(.data+0xc38):
>>  > undefined reference to
>>  > `org::eclipse::swt::widgets::Control::isReparentable()'
>>  >
>>  > org/vafada/swtcalendar/SWTCalendar.o:SWTCalendar.java:(.data+0xc3c):
>>  > undefined reference to
>>  > `org::eclipse::swt::widgets::Control::isShowing()'
>>  > I have included the swt.jar that MingW provides in the classpath. I
>>  > have also used the -fjni flag. I must be missing something here. Can
>>  > anyone give me any pointers?
>>
>> You haven't give us enough information.  In which jar is
>> org.eclipse.swt.windgets.Control?  Did you compile it?  What compile
>> args did you use?
>>
>> Andrew.
>>
> 
> 



More information about the Java mailing list