求助,编译问题!
Arduino:1.8.5 (Windows 7), 开发板:"WeMos D1 R1, 80 MHz, Flash, Enabled, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"c:/users/rain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\DHT-sensor-library-master\DHT.cpp.o: in function `DHT::DHT(unsigned char, unsigned char, unsigned char)':
C:\Users\rain\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.cpp:13: multiple definition of `DHT::DHT(unsigned char, unsigned char, unsigned char)'; libraries\Blinker\modules\dht\DHT.cpp.o:E:\arduino-1.8.5\libraries\Blinker\src\modules\dht/DHT.cpp:12: first defined here
c:/users/rain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\DHT-sensor-library-master\DHT.cpp.o: in function `DHT::DHT(unsigned char, unsigned char, unsigned char)':
C:\Users\rain\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.cpp:13: multiple definition of `DHT::DHT(unsigned char, unsigned char, unsigned char)'; libraries\Blinker\modules\dht\DHT.cpp.o:E:\arduino-1.8.5\libraries\Blinker\src\modules\dht/DHT.cpp:12: first defined here
c:/users/rain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\DHT-sensor-library-master\DHT.cpp.o: in function `DHT::begin()':
C:\Users\rain\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.cpp:25: multiple definition of `DHT::begin()'; libraries\Blinker\modules\dht\DHT.cpp.o:E:\arduino-1.8.5\libraries\Blinker\src\modules\dht/DHT.cpp:24: first defined here
c:/users/rain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\DHT-sensor-library-master\DHT.cpp.o: in function `DHT::convertCtoF(float)':
C:\Users\rain\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.cpp:68: multiple definition of `DHT::convertCtoF(float)'; libraries\Blinker\modules\dht\DHT.cpp.o:E:\arduino-1.8.5\libraries\Blinker\src\modules\dht/DHT.cpp:64: first defined here
c:/users/rain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\DHT-sensor-library-master\DHT.cpp.o: in function `DHT::convertFtoC(float)':
C:\Users\rain\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.cpp:73: multiple definition of `DHT::convertFtoC(float)'; libraries\Blinker\modules\dht\DHT.cpp.o:E:\arduino-1.8.5\libraries\Blinker\src\modules\dht/DHT.cpp:69: first defined here
c:/users/rain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\DHT-sensor-library-master\DHT.cpp.o: in function `DHT::computeHeatIndex(float, float, bool)':
"Blinker.h" 对应多个库
已使用: E:\arduino-1.8.5\libraries\Blinker
未使用:C:\Users\rain\Documents\Arduino\libraries\blinker-library-master
"DHT.h" 对应多个库
已使用: C:\Users\rain\Documents\Arduino\libraries\DHT-sensor-library-master
C:\Users\rain\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.cpp:103: multiple definition of `DHT::computeHeatIndex(float, float, bool)'; libraries\Blinker\modules\dht\DHT.cpp.o:E:\arduino-1.8.5\libraries\Blinker\src\modules\dht/DHT.cpp:92: first defined here
未使用:E:\arduino-1.8.5\libraries\DHT_sensor_library
"Hash.h" 对应多个库
已使用: C:\Users\rain\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0-beta2\libraries\Hash
未使用:E:\arduino-1.8.5\libraries\Hash
c:/users/rain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\DHT-sensor-library-master\DHT.cpp.o: in function `DHT::expectPulse(bool)':
C:\Users\rain\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.cpp:255: multiple definition of `DHT::expectPulse(bool)'; libraries\Blinker\modules\dht\DHT.cpp.o:E:\arduino-1.8.5\libraries\Blinker\src\modules\dht/DHT.cpp:237: first defined here
c:/users/rain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\DHT-sensor-library-master\DHT.cpp.o: in function `DHT::read(bool)':
C:\Users\rain\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.cpp:134: multiple definition of `DHT::read(bool)'; libraries\Blinker\modules\dht\DHT.cpp.o:E:\arduino-1.8.5\libraries\Blinker\src\modules\dht/DHT.cpp:123: first defined here
c:/users/rain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\DHT-sensor-library-master\DHT.cpp.o: in function `DHT::readTemperature(bool, bool)':
C:\Users\rain\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.cpp:36: multiple definition of `DHT::readTemperature(bool, bool)'; libraries\Blinker\modules\dht\DHT.cpp.o:E:\arduino-1.8.5\libraries\Blinker\src\modules\dht/DHT.cpp:35: first defined here
c:/users/rain/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\DHT-sensor-library-master\DHT.cpp.o: in function `DHT::readHumidity(bool)':
C:\Users\rain\Documents\Arduino\libraries\DHT-sensor-library-master/DHT.cpp:76: multiple definition of `DHT::readHumidity(bool)'; libraries\Blinker\modules\dht\DHT.cpp.o:E:\arduino-1.8.5\libraries\Blinker\src\modules\dht/DHT.cpp:72: first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
为开发板 WeMos D1 R1 编译时出错。
在文件 -> 首选项开启
“编译过程中显示详细输出”选项
这份报告会包含更多信息。
===================================================
collect2.exe: error: ld returned 1 exit status
exit status 1
为开发板 WeMos D1 R1 编译时出错。
这是什么错误?
本帖最后由 宇之枫海云 于 2019-1-25 12:14 编辑
/* *****************************************************************
*
* Download latest Blinker library here:
* https://github.com/blinker-iot/blinker-library/archive/master.zip
*
*
* Blinker is a cross-hardware, cross-platform solution for the IoT.
* It provides APP, device and server support,
* and uses public cloud services for data transmission and storage.
* It can be used in smart home, data monitoring and other fields
* to help users build Internet of Things projects better and faster.
*
* Make sure installed 2.5.0 or later ESP8266/Arduino package,
* if use ESP8266 with Blinker.
* https://github.com/esp8266/Arduino/releases
*
* Docs: https://doc.blinker.app/
* https://github.com/blinker-iot/blinker-doc/wiki
*
* *****************************************************************
*
* Blinker 库下载地址:
* https://github.com/blinker-iot/blinker-library/archive/master.zip
*
* Blinker 是一套跨硬件、跨平台的物联网解决方案,提供APP端、设备端、
* 服务器端支持,使用公有云服务进行数据传输存储。可用于智能家居、
* 数据监测等领域,可以帮助用户更好更快地搭建物联网项目。
*
* 如果使用 ESP8266 接入 Blinker,
* 请确保安装了 2.5.0 或更新的 ESP8266/Arduino 支持包。
* https://github.com/esp8266/Arduino/releases
*
* 文档: https://doc.blinker.app/
* https://github.com/blinker-iot/blinker-doc/wiki
*
* *****************************************************************/
#define BLINKER_WIFI
#include <Blinker.h>
char auth[] = "Your Device Secret Key";
char ssid[] = "Your WiFi network SSID or name";
char pswd[] = "Your WiFi network WPA password or WEP key";
BlinkerNumber HUMI("humi");
BlinkerNumber TEMP("temp");
// Download Adafruit DHT-sensor-library library here:
// https://github.com/adafruit/DHT-sensor-library
#include <DHT.h>
#define DHTPIN 2
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22(AM2302), AM2321
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
DHT dht(DHTPIN, DHTTYPE);
uint32_t read_time = 0;
float humi_read, temp_read;
void dataRead(const String & data)
{
BLINKER_LOG("Blinker readString: ", data);
Blinker.vibrate();
uint32_t BlinkerTime = millis();
Blinker.print(BlinkerTime);
Blinker.print("millis", BlinkerTime);
}
void heartbeat()
{
HUMI.print(humi_read);
TEMP.print(temp_read);
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
Blinker.attachHeartbeat(heartbeat);
dht.begin();
}
void loop()
{
Blinker.run();
if (read_time == 0 || (millis() - read_time) >= 2000)
{
read_time = millis();
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
BLINKER_LOG("Failed to read from DHT sensor!");
return;
}
float hic = dht.computeHeatIndex(t, h, false);
humi_read = h;
temp_read = t;
BLINKER_LOG("Humidity: ", h, " %");
BLINKER_LOG("Temperature: ", t, " *C");
BLINKER_LOG("Heat index: ", hic, " *C");
}
}
=====================================、
这个DHT.WIFI的例子
把blinker库完全删除后重新下载 跪谢三水大神啊!:victory:
页:
[1]