[Solved] Nibegw.c won't compile

Hey folks,

I am trying to set up a connection from an openhabian Pi4 to a Nibe Heatpump using an RS485 USB adapter and the nibwgw program as supplied by the binding. However, I am getting errors when I try to compile the C-program.

This is a fresh install of OpenHABian 1.6.3 (32-bit) on Raspberry Pi4 Model B.

I did:
gcc -std=gnu99 -o nibegw nibegw.c

And got the warnings/errors:

    nibegw.c: In function ‘getTimeStamp’:
nibegw.c:195:7: warning: implicit declaration of function ‘localtime’; did you mean ‘st_atime’? [-Wimplicit-function-declaration]
  tm = localtime(&tv.tv_sec);
nibegw.c:195:5: warning: assignment to ‘struct tm *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  tm = localtime(&tv.tv_sec);
nibegw.c:198:8: error: dereferencing pointer to incomplete type ‘struct tm’
      tm->tm_year + 1900,

I’m afraid, I’m not a C buff, so I’m lost already. Any helpful hints?


I apparently solved this by adding:

#include <time.h>

This was somehow missing, and i was confused by the already existing include to <sys/time.h>.



Seems this was fixed&merged already, please see [nibeheatpump] Fixed compile error in RasPi by paulianttila · Pull Request #10135 · openhab/openhab-addons · GitHub.