Hello,
I’m struggling using #include directive and on this error at the end of compiling session
After the error description the very simple code used by me
Processing adafruit_feather_m4 (platform: atmelsam; board: adafruit_feather_m4; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/adafruit_feather_m4.html
PLATFORM: Atmel SAM (8.1.0) > Adafruit Feather M4 Express
HARDWARE: SAMD51J19A 120MHz, 192KB RAM, 512KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, jlink)
PACKAGES:
- framework-arduino-samd-adafruit @ 1.7.10
- framework-cmsis @ 2.50400.181126 (5.4.0)
- framework-cmsis-atmel @ 1.2.2
- toolchain-gccarmnoneeabi @ 1.90301.200702 (9.3.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 11 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Linking .pio\build\adafruit_feather_m4\firmware.elf
d:/docs/pjs/platformio/platformiocoredir/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio\build\adafruit_feather_m4\src\main.cpp.o:(.bss.ui32Paolo+0x0): multiple definition of `ui32Paolo'; .pio\build\adafruit_feather_m4\src\HowTo.cpp.o:(.bss.ui32Paolo+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\adafruit_feather_m4\firmware.elf] Error 1
=============================================================================== [FAILED] Took 4.89 seconds ===============================================================================
This is the example
this is main.cpp
#include <Arduino.h>
#include <HowTo.h>
void setup() {
// put your setup code here, to run once:
SetupPaolo(25);
ui32Paolo =0;
}
void loop() {
// put your main code here, to run repeatedly:
ui32Paolo ++;
if (ui32Paolo>100) ui32Paolo =0;
delay(100);
}
This is HowTo.cpp
#include <Arduino.h>
#include <HowTo.h>
void SetupPaolo(uint32_t ui32Loc){
ui32Paolo = ui32Loc;
}
This is HowTo.h
#include <Arduino.h>
#ifndef _HOWTOH_
#define _HOWTOH_
uint32_t ui32Paolo =0;
void SetupPaolo(uint32_t ui32Loc);
#endif
Thanks a lot for anybody that can explain me to parameterize the compiler or to understand a mistake of mine