Hello, I’m trying to use, due flash limits, a part of a library, pio seems to recognize the library dependency but it doesn’t compile the files i need.
I think this is not an automated process so, is there an easy way to do that?
N.B. What I’m trying to use is USI_TWI_Slave.c/USI_TWI_Slave.h part of wire library
Please state the full platformio.ini
and code that fails.
Sorry, here it is:
.ini
; 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
[platformio]
default_envs = tests
[env:tests]
platform = atmelavr
board = attiny4313
framework = arduino
build_flags = -g0 -Os -D DISABLEMILLIS
.cpp
#include <Arduino.h>
#include <USI_TWI_Slave\USI_TWI_Slave.h>
void setup(){
USI_TWI_Slave_Initialise(0x3F);
}
void loop(){}
problem is a missing compiled file during linking stage
Is this file in the framework / arduino core or a library of the core? Or in a external library? (There are no lib_deps
declarations)
You’re including C prototypes (and functions implemented in C) in C++ code without using extern "C"
, which is wrong. Further you’re using Windows-style paths which will also only make the project compile under Windows – just use /
on all systems.
Works for me.
platformio.ini
[platformio]
default_envs = tests
[env:tests]
platform = atmelavr
board = attiny4313
framework = arduino
build_flags = -g0 -Os -D DISABLEMILLIS
lib_deps = Wire
main.cpp
#include <Arduino.h>
extern "C"{
#include <USI_TWI_Slave/USI_TWI_Slave.h>
}
void setup(){
USI_TWI_Slave_Initialise(0x3F);
}
void loop(){}
Yes, what a stupid, I think I’m a little bit “rusty” with c programming. Thanks again
1 Like