Undefined references for SWT

Harpal Grover harpal.grover@gmail.com
Sun Feb 11 16:27:00 GMT 2007


Okay,  I stated in my first post I am using GCJ for MingW  GCC/GCJ 4.3
(gcj-eclipse-merge-branch) on Windows XP, AMD 2.1 GHZ 512 MB

What I did not state I guess is I am using gcjbuilder, an eclipse
plugin to automate the build process :p  It creates a make file for
you. So I have included the make file:


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

#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= -O1

#compiler debug level
DEBUGLEVEL= -g0


#object targets
%.o:	%.java
	$(GCJ) $(CP)  -c $? -o $@
	
##################
#dummy targets (depend on config)

#classpath objects target
$(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)

So, the way this is executed is by the following line in MSYS :

$ make
mkdir -p release/resource
gcj  -O1 -g0  -c
--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;./;"
C:/thisiscool-gcc/swt/win32/3218/swt.jar -orelease/swt.jar.o
--main=App -fjni release/./gface_0.9.1.jar.o release/./swt.jar.o
App.o  -orelease/scnlm.exe -Lrelease

Is this more helpful? :)


On 2/11/07, Marco Trudel <mtrudel@gmx.ch> wrote:
> Harpal Grover wrote:
> > I think I figured out what may be the swt,
>
> I don't understand that....
>
>
> > I guess it's because the
> > the swt.jar wasn't the first jar being compiled in the command, so the
> > other jar's that relied on the swt library were failing.
>
> I don't understand tha

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


-- 
Harpal Grover
President
Harpal Grover Consulting Inc



More information about the Java mailing list