-->
Page 1 of 2

Can't compile sketch with DHT.h, what's wrong?

PostPosted: Mon May 08, 2017 8:51 pm
by Beto San
I can't Compile the sketch in Arduino IDE 1.8.2 with board Generic ESP8266 Module!
I put the code sketch of the post viewtopic.php?f=11&t=3569, saved in a folder alongside DHT.h from https://github.com/adafruit/DHT-sensor- ... ster/DHT.h but the time i try to compile these errors occurs:


Archiving built core (caching) in: C:\Users\Beto\AppData\Local\Temp\arduino_cache_129390\core\core_esp8266_esp8266_generic_CpuFrequency_80,FlashFreq_40,FlashMode_dio,UploadSpeed_115200,FlashSize_512K64,ResetMethod_ck,Debug_Disabled,DebugLevel_None_____d15f8909c9b4e6a4f9b307e83a579dfe.a
sketch\ESP8266_DHT22.ino.cpp.o:(.text.setup+0x2c): undefined reference to `DHT::begin()'

sketch\ESP8266_DHT22.ino.cpp.o:(.text.setup+0x51): undefined reference to `DHT::begin()'

sketch\ESP8266_DHT22.ino.cpp.o: In function `setup':

C:\Users\Beto\Desktop\ESP8266_DHT22/ESP8266_DHT22.ino:43: undefined reference to `DHT::DHT(unsigned char, unsigned char, unsigned char)'

sketch\ESP8266_DHT22.ino.cpp.o: In function `__static_initialization_and_destruction_0':

C:\Users\Beto\Desktop\ESP8266_DHT22/ESP8266_DHT22.ino:45: undefined reference to `DHT::DHT(unsigned char, unsigned char, unsigned char)'

sketch\ESP8266_DHT22.ino.cpp.o:(.text.loop+0x6c): undefined reference to `DHT::readHumidity(bool)'

sketch\ESP8266_DHT22.ino.cpp.o:(.text.loop+0x70): undefined reference to `DHT::readTemperature(bool, bool)'

sketch\ESP8266_DHT22.ino.cpp.o:(.text.loop+0x74): undefined reference to `DHT::computeHeatIndex(float, float, bool)'

sketch\ESP8266_DHT22.ino.cpp.o:(.text.loop+0x9b): undefined reference to `DHT::readHumidity(bool)'

sketch\ESP8266_DHT22.ino.cpp.o:(.text.loop+0xa9): undefined reference to `DHT::readTemperature(bool, bool)'

sketch\ESP8266_DHT22.ino.cpp.o:(.text.loop+0xb8): undefined reference to `DHT::readTemperature(bool, bool)'

sketch\ESP8266_DHT22.ino.cpp.o: In function `String::operator+=(char const*)':

C:\Users\Beto\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:121: undefined reference to `DHT::computeHeatIndex(float, float, bool)'

collect2.exe: error: ld returned 1 exit status

exit status 1
Erro compilando para a placa Generic ESP8266 Module

Re: Can't compile sketch with DHT.h, what's wrong?

PostPosted: Tue May 09, 2017 2:09 pm
by gbafamily1
Try install the correct DHT library using the IDE library manager. Copying DHT.h into your sketch directory is not sufficient. In the IDE, select Sketch -> Include Library -> Manager Libraries.

Re: Can't compile sketch with DHT.h, what's wrong?

PostPosted: Tue Jul 17, 2018 4:26 pm
by iam144
I seem to be having the same problem. I can'g get the esp8266-dht-thingspeak-logger.ino to compile. I tried including the DHT library through the Manage Libraries, but I still get the error below when I check the code.
I'm using a NodeMCU Amica board and the Arduino1.8.5 IDE. The backside of the board says to install the CP2102 driver, I've done that.

Here's the error I'm getting:

side note >>Where do I load the CP2102 board? <<
Arduino: 1.8.5 (Windows 7), Board: "Generic ESP8266 Module, 80 MHz, ck, 26 MHz, 40MHz, QIO, 512K (no SPIFFS), 2, v2 Lower Memory, Disabled, None, Only Sketch, 9600"

Archiving built core (caching) in: C:\Users\Bill\AppData\Local\Temp\arduino_cache_737877\core\core_esp8266_esp8266_generic_CpuFrequency_80,ResetMethod_ck,CrystalFreq_26,FlashFreq_40,FlashMode_qio,FlashSize_512K0,led_2,LwIPVariant_v2mss536,Debug_Disabled,DebugLevel_None____,FlashErase_none,UploadSpeed_9600_5b94eb0cdf9298c1339a327999ebc618.a
sketch\esp8266-dht-thingspeak-logger.ino.cpp.o: In function `setup':

C:\Users\Bill\Documents\Arduino\esp8266-dht-thingspeak-logger/esp8266-dht-thingspeak-logger.ino:76: undefined reference to `DHT::DHT(unsigned char, unsigned char, unsigned char)'

sketch\esp8266-dht-thingspeak-logger.ino.cpp.o: In function `__static_initialization_and_destruction_0':

C:\Users\Bill\Documents\Arduino\esp8266-dht-thingspeak-logger/esp8266-dht-thingspeak-logger.ino:78: undefined reference to `DHT::DHT(unsigned char, unsigned char, unsigned char)'

sketch\esp8266-dht-thingspeak-logger.ino.cpp.o: In function `setup':

C:\Users\Bill\Documents\Arduino\esp8266-dht-thingspeak-logger/esp8266-dht-thingspeak-logger.ino:85: undefined reference to `DHT::readHumidity(bool)'

C:\Users\Bill\Documents\Arduino\esp8266-dht-thingspeak-logger/esp8266-dht-thingspeak-logger.ino:85: undefined reference to `DHT::readTemperature(bool, bool)'

sketch\esp8266-dht-thingspeak-logger.ino.cpp.o:(.text.loop+0x90): undefined reference to `DHT::readHumidity(bool)'

sketch\esp8266-dht-thingspeak-logger.ino.cpp.o:(.text.loop+0x9e): undefined reference to `DHT::readTemperature(bool, bool)'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Generic ESP8266 Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Re: Can't compile sketch with DHT.h, what's wrong?

PostPosted: Mon Jul 23, 2018 4:30 am
by schufti
propable cause: you forgot or messed up the installation of the (correct, there might be several) DHT library