Hey there,
i transfered my Project from Arduino IDE to Platformio.
I tried to compile it for Wemos D2 mini but it won’t work …
[04/28/18 17:24:58] Processing d1_mini (platform: espressif8266; board: d1_mini; framework: arduino)
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Espressif 8266 > WeMos D1 R2 & mini
SYSTEM: ESP8266 80MHz 80KB RAM (4MB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(light)
Collected 29 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Wire> v1.0
|-- <HX711> v0.1
|-- <ESP8266_SSD1306> v3.2.7
| |-- <Wire> v1.0
|-- <ESP8266WiFi> v1.0
|-- <Adafruit MQTT Library> v0.20.1
Linking .pioenvs\d1_mini\firmware.elf
.pioenvs\d1_mini\src\display.cpp.o:(.bss.display+0x0): multiple definition of `display'
.pioenvs\d1_mini\src\data.cpp.o:(.bss.display+0x0): first defined here
.pioenvs\d1_mini\src\display.cpp.o:(.bss.visualBatteryState+0x0): multiple definition of `visualBatteryState'
.pioenvs\d1_mini\src\data.cpp.o:(.bss.visualBatteryState+0x0): first defined here
.pioenvs\d1_mini\src\display.cpp.o:(.bss.contrast+0x0): multiple definition of `contrast'
.pioenvs\d1_mini\src\data.cpp.o:(.bss.contrast+0x0): first defined here
.pioenvs\d1_mini\src\main.cpp.o:(.bss.data+0x0): multiple definition of `data'
.pioenvs\d1_mini\src\data.cpp.o:(.bss.data+0x0): first defined here
.pioenvs\d1_mini\src\main.cpp.o:(.bss.display+0x0): multiple definition of `display'
.pioenvs\d1_mini\src\data.cpp.o:(.bss.display+0x0): first defined here
.pioenvs\d1_mini\src\main.cpp.o:(.bss.datalabel+0x0): multiple definition of `datalabel'
.pioenvs\d1_mini\src\data.cpp.o:(.bss.datalabel+0x0): first defined here
.pioenvs\d1_mini\src\main.cpp.o:(.bss.GyroZ+0x0): multiple definition of `GyroZ'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.GyroZ+0x0): first defined here
.pioenvs\d1_mini\src\main.cpp.o:(.bss.GyroY+0x0): multiple definition of `GyroY'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.GyroY+0x0): first defined here
.pioenvs\d1_mini\src\main.cpp.o:(.bss.GyroX+0x0): multiple definition of `GyroX'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.GyroX+0x0): first defined here
.pioenvs\d1_mini\src\main.cpp.o:(.bss.Temperature+0x0): multiple definition of `Temperature'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.Temperature+0x0): first defined here
.pioenvs\d1_mini\src\main.cpp.o:(.bss.AccelZ+0x0): multiple definition of `AccelZ'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.AccelZ+0x0): first defined here
.pioenvs\d1_mini\src\main.cpp.o:(.bss.AccelY+0x0): multiple definition of `AccelY'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.AccelY+0x0): first defined here
.pioenvs\d1_mini\src\main.cpp.o:(.bss.AccelX+0x0): multiple definition of `AccelX'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.AccelX+0x0): first defined here
.pioenvs\d1_mini\src\main.cpp.o:(.bss.contrast+0x0): multiple definition of `contrast'
.pioenvs\d1_mini\src\data.cpp.o:(.bss.contrast+0x0): first defined here
.pioenvs\d1_mini\src\main.cpp.o:(.bss.visualBatteryState+0x0): multiple definition of `visualBatteryState'
.pioenvs\d1_mini\src\data.cpp.o:(.bss.visualBatteryState+0x0): first defined here
.pioenvs\d1_mini\src\sensors.cpp.o:(.bss.GyroZ+0x0): multiple definition of `GyroZ'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.GyroZ+0x0): first defined here
.pioenvs\d1_mini\src\sensors.cpp.o:(.bss.GyroY+0x0): multiple definition of `GyroY'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.GyroY+0x0): first defined here
.pioenvs\d1_mini\src\sensors.cpp.o:(.bss.GyroX+0x0): multiple definition of `GyroX'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.GyroX+0x0): first defined here
.pioenvs\d1_mini\src\sensors.cpp.o:(.bss.Temperature+0x0): multiple definition of `Temperature'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.Temperature+0x0): first defined here
.pioenvs\d1_mini\src\sensors.cpp.o:(.bss.AccelZ+0x0): multiple definition of `AccelZ'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.AccelZ+0x0): first defined here
.pioenvs\d1_mini\src\sensors.cpp.o:(.bss.AccelY+0x0): multiple definition of `AccelY'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.AccelY+0x0): first defined here
.pioenvs\d1_mini\src\sensors.cpp.o:(.bss.AccelX+0x0): multiple definition of `AccelX'
.pioenvs\d1_mini\src\MPU6050.cpp.o:(.bss.AccelX+0x0): first defined here
.pioenvs\d1_mini\src\wireless.cpp.o:(.bss.mqtt+0x0): multiple definition of `mqtt'
.pioenvs\d1_mini\src\main.cpp.o:(.bss.mqtt+0x0): first defined here
.pioenvs\d1_mini\src\wireless.cpp.o:(.bss.espClient+0x0): multiple definition of `espClient'
.pioenvs\d1_mini\src\main.cpp.o:(.bss.espClient+0x0): first defined here
.pioenvs\d1_mini\src\wireless.cpp.o:(.bss.publishData+0x0): multiple definition of `publishData'
.pioenvs\d1_mini\src\main.cpp.o:(.bss.publishData+0x0): first defined here
.pioenvs\d1_mini\src\wireless.cpp.o:(.bss.lastMsg+0x0): multiple definition of `lastMsg'
.pioenvs\d1_mini\src\main.cpp.o:(.bss.lastMsg+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
*** [.pioenvs\d1_mini\firmware.elf] Error 1
[ERROR] Took 3.27 seconds
Actually the header and cpp files are all fine, so i don’t understand why it thinks it is defined more then once.
All header files are structured the same way, so I’ll give you an example file.
#ifndef wireless_h
#define wireless_h
//Includes Wireless Transmission libaries
#include <Adafruit_MQTT.h>
#include <Adafruit_MQTT_Client.h>
#include <ESP8266WiFi.h>
#include "configuration.h"
WiFiClient espClient;
Adafruit_MQTT_Client mqtt(&espClient, mqtt_server, 1883);
Adafruit_MQTT_Publish publishData = Adafruit_MQTT_Publish(&mqtt, "/");
long lastMsg = 0;
void MQTT_connect();
void setup_wifi();
#endif
The equivalent cpp file only includes header files and writes out the methods.
I would be glad for any ideas.