SEN0482 Wind Direction Complie error

userHead tstephens 2022-11-12 20:24:48 1117 Views3 Replies

Hi, having issues getting the provided code to compile. Running Raspberry Bullseye lite on Pi Zero W.

 

Have followed instructions on page here:
https://wiki.dfrobot.com/RS485_Wind_Direction_Transmitter_SKU_SEN0482#target_7

 

When I run the gcc command to compile, I get the folowing error.

 

Any ideas on how to fix this? Thanks!

 

Tim

 

/usr/bin/ld: /tmp/cczf094m.o:(.bss+0x0): multiple definition of `fd'; /tmp/ccIlIgNn.o:(.bss+0x0): first defined here                                                                                /usr/bin/ld: /tmp/ccIlIgNn.o: in function `main':                                                                                                                                                   main.c:(.text+0x50): undefined reference to `delay'                                                                                                                                                 /usr/bin/ld: main.c:(.text+0xbc): undefined reference to `delay'                                                                                                                                    /usr/bin/ld: /tmp/cczf094m.o: in function `ModifyAddress':                                                                                                                                          RS485_Wind_Direction_Transmitter.c:(.text+0x158): undefined reference to `millis'                                                                                                                   /usr/bin/ld: RS485_Wind_Direction_Transmitter.c:(.text+0x1b0): undefined reference to `millis'                                                                                                      /usr/bin/ld: RS485_Wind_Direction_Transmitter.c:(.text+0x1c8): undefined reference to `millis'                                                                                                      /usr/bin/ld: RS485_Wind_Direction_Transmitter.c:(.text+0x1f8): undefined reference to `millis'                                                                                                      /usr/bin/ld: RS485_Wind_Direction_Transmitter.c:(.text+0x210): undefined reference to `serialDataAvail'                                                                                             /usr/bin/ld: RS485_Wind_Direction_Transmitter.c:(.text+0x224): undefined reference to `delay'                                                                                                       /usr/bin/ld: /tmp/cczf094m.o: in function `Init':                                                                                                                                                   RS485_Wind_Direction_Transmitter.c:(.text+0x3b8): undefined reference to `serialOpen'                                                                                                               /usr/bin/ld: /tmp/cczf094m.o: in function `readWindDirection':                                                                                                                                      RS485_Wind_Direction_Transmitter.c:(.text+0x478): undefined reference to `millis'                                                                                                                   /usr/bin/ld: RS485_Wind_Direction_Transmitter.c:(.text+0x4c8): undefined reference to `millis'                                                                                                      /usr/bin/ld: RS485_Wind_Direction_Transmitter.c:(.text+0x4ec): undefined reference to `millis'                                                                                                      /usr/bin/ld: RS485_Wind_Direction_Transmitter.c:(.text+0x51c): undefined reference to `millis'                                                                                                      /usr/bin/ld: RS485_Wind_Direction_Transmitter.c:(.text+0x534): undefined reference to `serialDataAvail'                                                                                             /usr/bin/ld: RS485_Wind_Direction_Transmitter.c:(.text+0x548): undefined reference to `delay'  

2022-11-14 02:05:48

OKAY found the problem - for anyone having a similar issue - it's in the version 10.x of gcc. I downgraded to gcc-8 and it compiles correctly.Tim

userHeadPic tstephens
2022-11-13 22:34:34

Okay… so it seems to be something to do with the version of raspbian (bullseye) or my particular install. It comples correctly on another Pi I have here running buster.

userHeadPic tstephens
2022-11-13 00:18:01

Edit: here's a better formatted error list below.

 

Also… I can remove most of the undefined references (as if it's can't link a library?!) by running 

gcc -Wall -o Wind_Speed *.c -lwiringPi 

 

and now only the first error remains:

/usr/bin/ld: /tmp/cc0RGEZU.o:(.bss+0x0): multiple definition of `fd'; /tmp/ccVhZ6rU.o:(.bss+0x0): first defined here

 

I can't code in c++ so can't figure out why the function fd would be referencing twice?!

 

Tim

 

 

Reformatted error:

/usr/bin/ld: /tmp/ccuGudLt.o:(.bss+0x0): multiple definition of `fd'; /tmp/ccb3g0Xr.o:(.bss+0x0): first defined here /usr/bin/ld: /tmp/ccb3g0Xr.o: in function `main':main.c:(.text+0x24): undefined reference to `delay' /usr/bin/ld: main.c:(.text+0x88): undefined reference to `delay'/usr/bin/ld: /tmp/ccuGudLt.o: in function `ModifyAddress': RS485_Wind_Speed_Transmitter.c:(.text+0x158): undefined reference to `millis' /usr/bin/ld: RS485_Wind_Speed_Transmitter.c:(.text+0x1b0): undefined reference to `millis'          /usr/bin/ld: RS485_Wind_Speed_Transmitter.c:(.text+0x1c8): undefined reference to `millis'          /usr/bin/ld: RS485_Wind_Speed_Transmitter.c:(.text+0x1f8): undefined reference to `millis'          /usr/bin/ld: RS485_Wind_Speed_Transmitter.c:(.text+0x210): undefined reference to `serialDataAvail' /usr/bin/ld: RS485_Wind_Speed_Transmitter.c:(.text+0x224): undefined reference to `delay'           /usr/bin/ld: /tmp/ccuGudLt.o: in function `Init':                                                   RS485_Wind_Speed_Transmitter.c:(.text+0x3b8): undefined reference to `serialOpen'                   /usr/bin/ld: /tmp/ccuGudLt.o: in function `readWindSpeed':                                          RS485_Wind_Speed_Transmitter.c:(.text+0x478): undefined reference to `millis'                       /usr/bin/ld: RS485_Wind_Speed_Transmitter.c:(.text+0x4c8): undefined reference to `millis'          /usr/bin/ld: RS485_Wind_Speed_Transmitter.c:(.text+0x4ec): undefined reference to `millis'          /usr/bin/ld: RS485_Wind_Speed_Transmitter.c:(.text+0x51c): undefined reference to `millis'          /usr/bin/ld: RS485_Wind_Speed_Transmitter.c:(.text+0x534): undefined reference to `serialDataAvail' /usr/bin/ld: RS485_Wind_Speed_Transmitter.c:(.text+0x548): undefined reference to `delay' 

userHeadPic tstephens