Dear,
I’m coding a multiple configuration files for Arduino dev. When building, I’ve got many error concerning libraries…
Please find hereafter the .ini file and my source file.
Thanks a lot for your support.
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env]
platform = atmelavr
board = uno
framework = arduino
lib_extra_dirs = ~/Documents/Arduino/libraries
lib_ldf_mode = chain+
[env:projet2]
platform = atmelavr
board = uno
framework = arduino
lib_extra_dirs = ~/Documents/Arduino/libraries
build_src_filter = +</Users/florenttainturier/Fablab-Escape/fablabescape/Fabrication/EscapeMain-TestServo/src/projet2>
[env:projet1]
platform = atmelavr
board = uno
framework = arduino
lib_extra_dirs = ~/Documents/Arduino/libraries
build_src_filter = +</Users/florenttainturier/Fablab-Escape/fablabescape/Fabrication/EscapeMain-TestServo/src/projet1>
And one of my example test
#include <Wire.h>
void setup() {
Wire.begin(8); // join i2c bus with address #8
Wire.onRequest(requestEvent); // register event
}
void loop() {
delay(100);
}
// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent() {
Wire.write("hello "); // respond with message of 6 bytes
// as expected by master
}
My error messages
* Executing task in folder EscapeMain-TestServo: platformio run --environment projet1
Processing projet1 (platform: atmelavr; board: uno; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (5.0.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES:
- framework-arduino-avr @ 5.2.0
- toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain+, Compatibility ~ soft
Found 25 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Wire @ 1.0
Building in release mode
Compiling .pio/build/projet1/src/projet1/sender.c.o
Archiving .pio/build/projet1/libd66/libWire.a
Compiling .pio/build/projet1/FrameworkArduino/HardwareSerial2.cpp.o
In file included from /Users/florenttainturier/.platformio/packages/framework-arduino-avr/cores/arduino/Print.h:27:0,
from /Users/florenttainturier/.platformio/packages/framework-arduino-avr/cores/arduino/Stream.h:26,
from /Users/florenttainturier/.platformio/packages/framework-arduino-avr/libraries/Wire/src/Wire.h:27,
from src/projet1/sender.c:1:
/Users/florenttainturier/.platformio/packages/framework-arduino-avr/cores/arduino/Printable.h:25:1: error: unknown type name 'class'; did you mean 'labs'?
class Print;
^~~~~
labs
/Users/florenttainturier/.platformio/packages/framework-arduino-avr/cores/arduino/Printable.h:33:1: error: unknown type name 'class'; did you mean 'labs'?
class Printable
^~~~~
labs
/Users/florenttainturier/.platformio/packages/framework-arduino-avr/cores/arduino/Printable.h:34:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
{
^
In file included from /Users/florenttainturier/.platformio/packages/framework-arduino-avr/cores/arduino/Stream.h:26:0,
from /Users/florenttainturier/.platformio/packages/framework-arduino-avr/libraries/Wire/src/Wire.h:27,
from src/projet1/sender.c:1:
/Users/florenttainturier/.platformio/packages/framework-arduino-avr/cores/arduino/Print.h:37:1: error: unknown type name 'class'; did you mean 'labs'?
class Print
^~~~~
labs
/Users/florenttainturier/.platformio/packages/framework-arduino-avr/cores/arduino/Print.h:38:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
{
^
In file included from /Users/florenttainturier/.platformio/packages/framework-arduino-avr/libraries/Wire/src/Wire.h:27:0,
from src/projet1/sender.c:1:
/Users/florenttainturier/.platformio/packages/framework-arduino-avr/cores/arduino/Stream.h:49:1: error: unknown type name 'class'; did you mean 'labs'?
class Stream : public Print
^~~~~
labs
/Users/florenttainturier/.platformio/packages/framework-arduino-avr/cores/arduino/Stream.h:49:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
class Stream : public Print
^
In file included from src/projet1/sender.c:1:0:
/Users/florenttainturier/.platformio/packages/framework-arduino-avr/libraries/Wire/src/Wire.h:34:1: error: unknown type name 'class'; did you mean 'labs'?
class TwoWire : public Stream
^~~~~
labs
/Users/florenttainturier/.platformio/packages/framework-arduino-avr/libraries/Wire/src/Wire.h:34:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
class TwoWire : public Stream
^
/Users/florenttainturier/.platformio/packages/framework-arduino-avr/libraries/Wire/src/Wire.h:86:8: error: unknown type name 'TwoWire'
extern TwoWire Wire;
^~~~~~~
src/projet1/sender.c: In function 'setup':
src/projet1/sender.c:4:7: error: request for member 'begin' in something not a structure or union
Wire.begin(8); // join i2c bus with address #8
^
src/projet1/sender.c:5:7: error: request for member 'onRequest' in something not a structure or union
Wire.onRequest(requestEvent); // register event
^
src/projet1/sender.c:5:18: error: 'requestEvent' undeclared (first use in this function)
Wire.onRequest(requestEvent); // register event
^~~~~~~~~~~~
src/projet1/sender.c:5:18: note: each undeclared identifier is reported only once for each function it appears in
src/projet1/sender.c: In function 'loop':
src/projet1/sender.c:9:3: warning: implicit declaration of function 'delay' [-Wimplicit-function-declaration]
delay(100);
^~~~~
src/projet1/sender.c: In function 'requestEvent':
src/projet1/sender.c:15:7: error: request for member 'write' in something not a structure or union
Wire.write("hello "); // respond with message of 6 bytes
^
Compiling .pio/build/projet1/FrameworkArduino/HardwareSerial3.cpp.o
*** [.pio/build/projet1/src/projet1/sender.c.o] Error 1
Indexing .pio/build/projet1/libd66/libWire.a
========================================================== [FAILED] Took 0.45 seconds ==========================================================
Environment Status Duration
------------- -------- ------------
projet1 FAILED 00:00:00.448
==================================================== 1 failed, 0 succeeded in 00:00:00.448 ====================================================
* The terminal process "platformio 'run', '--environment', 'projet1'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.