-->
Page 1 of 1

Compiler / Linker Problem

PostPosted: Tue Feb 06, 2018 1:05 pm
by Arnold
Hello Together,

i think the compiler / linker is still buggy.

I just moved one variable from the main file to one header file an i get various errors which are strange.

Moved: I2cbuffer from main app to global.h

then compiled again and got this errorĀ“s

BasicObjClass.cpp.o*: In function BasicObjCLass::run(int)
BasicObjClass.h:36: multiple definition of i2c_buffer
sonoff.cpp.o*: ..arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266\pgmspace.h:103: first defined here
global.cpp.o*: (.bss.i2c_buffer+0x0): multiple definition of i2c_buffer
sonoff.cpp.o*: ..l\arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266\pgmspace.h:103: first defined here
PCF8574.cpp.o*: (.bss.i2c_buffer+0x0): multiple definition of i2c_buffer

Error linking for board Generic ESP8266 Module
sonoff.cpp.o*: C:\Users\Braun\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266\pgmspace.h:103: first defined here

PCF8591.cpp.o*: In function PCF8591::getid()
PCF8591.h:29: multiple definition of i2c_buffer
sonoff.cpp.o*: ..l\arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266\pgmspace.h:103: first defined here
TFTSD1303.cpp.o*: (.bss.i2c_buffer+0x0): multiple definition of i2c_buffer
sonoff.cpp.o*: ..l\arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266\pgmspace.h:103: first defined here
Build failed for project 'sonoff'


The global.h ist not big and looks like this:


// global.h

#ifndef _GLOBAL_h
#define _GLOBAL_h

#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif

#define I2C_RETRY_COUNTER 3

uint32_t i2c_buffer = 0;

String GetFirstParam(String * param, const char seperator);

int8 GetIndex(String param, String Search, const char seperator);
String GetEntry(uint8_t idx, String param);

uint8_t I2cRead8(uint8_t addr, uint8_t reg);
bool I2cValidRead(uint8_t addr, uint8_t reg, uint8_t size);


#endif

global.cpp

#include "global.h"

#include "Wire.h"




String GetFirstParam(String *param, const char seperator) // Extract the first param
{
and so on