undefined reference to `CheckError' - solved

C, C++, and Visual C++
Post Reply
asd
Phidgetsian
Posts: 7
Joined: Wed Sep 19, 2018 12:32 pm
Contact:

undefined reference to `CheckError' - solved

Post 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

BIN=example
SRCS=TemperatureSensor_Example.c ../Common/PhidgetHelperFunctions.c
LIBS=-lphidget22
LIBDIR=-I/home/asd/phidgets/libphidget22-1.0.0.20180905/.libs
INCDIR=-L/home/asd/phidgets/examples/Phidget22_TemperatureSensor_C_Ex_20180905/Common

CFLAGS=-ggdb3 -Wall -v

all:
	${CC} ${CFLAGS} -o ${BIN} ${SRCS} ${INCDIR} ${LIBDIR} ${LIBS}
All best,
Matthias
ghostlyroaster
Fresh meat
Posts: 1
Joined: Sun Nov 18, 2018 1:59 pm
Contact:

Re: undefined reference to `CheckError' - solved

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

Kyle

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
root@phidgetsbc:/usr/userapps/MtrCntrl#
User avatar
Patrick
Lead Developer
Posts: 3403
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: undefined reference to `CheckError' - solved

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

-Patrick
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests