Errors when compiling VoltageRatioInputExample.c ?
Posted: Wed Nov 21, 2018 12:47 pm
Hi there! I've been trying to get the Phidgetbridge to work on Raspbian but something's not quite right. Anyone know what's going on? My notes are below.
When I compile with
cc -ggdb3 -Wall -o VoltageRatioInputExample VoltageRatioInput_Example.c ../Common/PhidgetHelperFunctions.c -I../Common -lphidget22
(The command produced from make) I get
VoltageRatioInput_Example.c: In function ‘onAttachHandler’:
VoltageRatioInput_Example.c:38:40: warning: passing argument 2 of ‘Phidget_getChannelClassName’ from incompatible pointer type [-Wincompatible-pointer-types]
prc = Phidget_getChannelClassName(ph, &channelClassName);
^
In file included from VoltageRatioInput_Example.c:4:0:
/usr/local/include/phidget22.h:723:20: note: expected ‘const char **’ but argument is of type ‘char **’
PhidgetReturnCode Phidget_getChannelClassName (PhidgetHandle phid, const char **channelClassName);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
VoltageRatioInput_Example.c: In function ‘onDetachHandler’:
VoltageRatioInput_Example.c:117:40: warning: passing argument 2 of ‘Phidget_getChannelClassName’ from incompatible pointer type [-Wincompatible-pointer-types]
prc = Phidget_getChannelClassName(ph, &channelClassName);
^
In file included from VoltageRatioInput_Example.c:4:0:
/usr/local/include/phidget22.h:723:20: note: expected ‘const char **’ but argument is of type ‘char **’
PhidgetReturnCode Phidget_getChannelClassName (PhidgetHandle phid, const char **channelClassName);
but it still generates an executable. When I run that with a phidget bridge attached to a USB on the Raspberry Pi, and a load cell attached to channel 2 on the phidget bridge, I get the following results for various inputs:
533575 (serial#)
n (not VINT hub)
2
n (no network)
timed out
533575 (serial#)
y (VINT hub)
-1
n (not hub port)
2
n (not network)
timed out
533575 (serial#)
n (not VINT hub)
2
y (yes network)
y (enable network discovery)
timed out
(I would expect this to fail, since I haven't set up a network server yet)
533575 (serial#)
y (yes VINT hub)
-1
y (yes hub port)
n (not network)
timed out
When I plug the phidget bridge into the Raspberry Py, dmesg | tail gives the usual stuff, so it recognizes the thing clearly. When I plug it into a windows machine I can read the data coming off the load cell easily with the GUI, so I suspect the issue is with that problem during code compilation.
I also had some errors come up when I tried to install the libphidgetjava stuff, mostly to do with redundant definitions of things. Can only one be installed at a time? C or java but not both? Also the above compilation errors above don't seem to mention redundant definitions, though that could explain a change from const char ** to char **, and the executable mostly works, but it just doesn't connect. Plus it ought to work just fine with Char ** as long as that's not getting changed by the connection process? Though maybe that's not a fair assumption.
When I compile with
cc -ggdb3 -Wall -o VoltageRatioInputExample VoltageRatioInput_Example.c ../Common/PhidgetHelperFunctions.c -I../Common -lphidget22
(The command produced from make) I get
VoltageRatioInput_Example.c: In function ‘onAttachHandler’:
VoltageRatioInput_Example.c:38:40: warning: passing argument 2 of ‘Phidget_getChannelClassName’ from incompatible pointer type [-Wincompatible-pointer-types]
prc = Phidget_getChannelClassName(ph, &channelClassName);
^
In file included from VoltageRatioInput_Example.c:4:0:
/usr/local/include/phidget22.h:723:20: note: expected ‘const char **’ but argument is of type ‘char **’
PhidgetReturnCode Phidget_getChannelClassName (PhidgetHandle phid, const char **channelClassName);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
VoltageRatioInput_Example.c: In function ‘onDetachHandler’:
VoltageRatioInput_Example.c:117:40: warning: passing argument 2 of ‘Phidget_getChannelClassName’ from incompatible pointer type [-Wincompatible-pointer-types]
prc = Phidget_getChannelClassName(ph, &channelClassName);
^
In file included from VoltageRatioInput_Example.c:4:0:
/usr/local/include/phidget22.h:723:20: note: expected ‘const char **’ but argument is of type ‘char **’
PhidgetReturnCode Phidget_getChannelClassName (PhidgetHandle phid, const char **channelClassName);
but it still generates an executable. When I run that with a phidget bridge attached to a USB on the Raspberry Pi, and a load cell attached to channel 2 on the phidget bridge, I get the following results for various inputs:
533575 (serial#)
n (not VINT hub)
2
n (no network)
timed out
533575 (serial#)
y (VINT hub)
-1
n (not hub port)
2
n (not network)
timed out
533575 (serial#)
n (not VINT hub)
2
y (yes network)
y (enable network discovery)
timed out
(I would expect this to fail, since I haven't set up a network server yet)
533575 (serial#)
y (yes VINT hub)
-1
y (yes hub port)
n (not network)
timed out
When I plug the phidget bridge into the Raspberry Py, dmesg | tail gives the usual stuff, so it recognizes the thing clearly. When I plug it into a windows machine I can read the data coming off the load cell easily with the GUI, so I suspect the issue is with that problem during code compilation.
I also had some errors come up when I tried to install the libphidgetjava stuff, mostly to do with redundant definitions of things. Can only one be installed at a time? C or java but not both? Also the above compilation errors above don't seem to mention redundant definitions, though that could explain a change from const char ** to char **, and the executable mostly works, but it just doesn't connect. Plus it ought to work just fine with Char ** as long as that's not getting changed by the connection process? Though maybe that's not a fair assumption.