Page 1 of 1

undefined reference to `CheckError' - solved

Posted: Fri Sep 21, 2018 2:04 am
by asd
Hi guys,
just in case anyone else is having this problem.
I was trying to compile TemperatureSensor_Example.c but it complained about the reference to CheckError (declared in PhidgetHelperFunctions.c).

I had to modify the original make file (SRCS) to also compile PhidgetHelperFunctions.c:

The Makefile

Code: Select all

SRCS=TemperatureSensor_Example.c ../Common/PhidgetHelperFunctions.c

CFLAGS=-ggdb3 -Wall -v

   ${CC} ${CFLAGS} -o ${BIN} ${SRCS} ${INCDIR} ${LIBDIR} ${LIBS}

All best,

Re: undefined reference to `CheckError' - solved

Posted: Tue Nov 20, 2018 6:52 pm
by ghostlyroaster
I have searched for a compile problem for a few days now so I do appreciate you posting this. I am also getting this and a few more errors which I will show below. Without going into a very long setup and explanation would you have any suggestions?

I am trying to use the Stepper_Example.c with the default makefile.


root@phidgetsbc:~# cd /usr/userapps/MtrCntrl
root@phidgetsbc:/usr/userapps/MtrCntrl# gcc Stepper_Example.c -lphidget22
Stepper_Example.c: In function 'onAttachHandler':
Stepper_Example.c:37:2: warning: passing argument 2 of 'Phidget_getChannelClassName' from incompatible pointer type [enabled by default]
/usr/include/phidget22.h:795:20: note: expected 'const char **' but argument is of type 'char **'
Stepper_Example.c: In function 'onDetachHandler':
Stepper_Example.c:99:2: warning: passing argument 2 of 'Phidget_getChannelClassName' from incompatible pointer type [enabled by default]
/usr/include/phidget22.h:795:20: note: expected 'const char **' but argument is of type 'char **'
/tmp/ccInugdY.o: In function `onAttachHandler':
Stepper_Example.c:(.text+0x48): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x74): undefined reference to `CheckError'
Stepper_Example.c:(.text+0xa0): undefined reference to `CheckError'
Stepper_Example.c:(.text+0xcc): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x104): undefined reference to `CheckError'
/tmp/ccInugdY.o:Stepper_Example.c:(.text+0x168): more undefined references to `CheckError' follow
/tmp/ccInugdY.o: In function `main':
Stepper_Example.c:(.text+0x44c): undefined reference to `AskForDeviceParameters'
Stepper_Example.c:(.text+0x478): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x4a4): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x4d0): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x508): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x530): undefined reference to `CheckEnableServerDiscoveryError'
Stepper_Example.c:(.text+0x570): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x5ac): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x5e0): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x614): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x64c): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x678): undefined reference to `CheckOpenError'
Stepper_Example.c:(.text+0x6e4): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x710): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x894): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x8dc): undefined reference to `CheckError'
Stepper_Example.c:(.text+0x910): undefined reference to `CheckError'
/tmp/ccInugdY.o:Stepper_Example.c:(.text+0x934): more undefined references to `CheckError' follow
collect2: ld returned 1 exit status

Re: undefined reference to `CheckError' - solved

Posted: Wed Nov 21, 2018 11:57 am
by Patrick
Looks like you are trying to just compile the example directly with gcc. CheckError is defined is a seperated file - PhidgetHelperFunctions.c, which is also compiled by the Makefile, and included in the example download. The examples have been updated with the fixed Makefile.