PlatformIO Community

PIO Optional Parameter not working, on arduino working fine

Hi guys,
Optional Parameter not working on PIO but on arduino it’s working fine.
This is the error:
In function global constructors keyed to 65535_0_main.cpp.o.2165': <artificial>:(.text.startup+0x2d8): undefined reference toLiquidCrystal_I2C::LiquidCrystal_I2C(unsigned char, unsigned char, unsigned char, unsigned char)’
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\uno\firmware.elf] Error 1

These is the imlementation
LiquidCrystal_I2C(uint8_t lcd_addr, uint8_t lcd_cols, uint8_t lcd_rows, uint8_t charsize =
as you can see the 4th parameter is optional.
LiquidCrystal_I2C lcd(0x27,16,2);

Can you provide a minimal reproducible example (platformio.ini, minimal main.cpp) and more information about your environment?

I doubt it has anything to do with optional parameters. Arduino IDE and PlatformIO use the same compilers and linkers.

1 Like

Hi Manuel,
my sincere apology for the late reply.
that is the build error

this is the LiquidCrystal_I2C.h

Im not sure where can i find the ini for these

I am currently using windows 10 64bit,
these is my main.cpp

where can i find the platform,ini

You have the LiquidCrystal_I2C.cpp in include/, but in this folder no code is compiled, only headers are included.

Either place LiquidCrystal_I2C.cpp in src/ or remove your own copy of LiquidCrystal and place

lib_deps =

into the platformio.ini.

1 Like

let me try ill get back to you

you are a legend…thanks man…

It was right there in each of the screenshots! :stuck_out_tongue: I guess you realised that by now, as you’ve either used the lib_deps parameter to install the library properly, or copied the .cpp file into your src folder.

i was using my mouth not my eyes…:stuck_out_tongue: but thanks for the hlep

1 Like