HTU21D library compile error

Hi,

I am getting compiling error for HTU21D library from https://github.com/romainmp/HTU21D release version out of Build.particle.io.

Compiling code for photon

Including:
HTU21D.cpp
HTU21D.h
HTU21D.ino
attempting to compile firmware
Compile failed. Exiting.
…/…/…/build/target/user/platform-6/libuser.a(HTU21D.o): In function setup': HTU21D.cpp:11: undefined reference toHTU21D::begin()’
…/…/…/build/target/user/platform-6/libuser.a(HTU21D.o): In function loop': HTU21D.cpp:22: undefined reference toHTU21D::readHumidity()‘
HTU21D.cpp:23: undefined reference to HTU21D::readTemperature()' ../../../build/target/user/platform-6/libuser.a(HTU21D.o): In function__static_initialization_and_destruction_0’:
HTU21D.cpp:3: undefined reference to `HTU21D::HTU21D()'
collect2: error: ld returned 1 exit status
make: *** [9d8d4290b9a2fa4362d61bd14766ce214c29ff2a32d170a4fe1ba27f858e.elf] Error 1

Does anyone have a working version of HTU21D library for Photon?

Thanks in advance.

You can’t have both HTU21D.cpp and HTU21D.ino. Rename one of them, such as HTU21DTest.ino, and that problem should go away. The reason is both .cpp and .ino files compile to .o files, and one overwrites the other.

@rickkas7, Thanks, it did the job. :smile:

1 Like