Hello!
I’m trying to setup Platform IO on Neovim. I have tried with VSCodium, the error is the same.
Issue
My main issue is with the LSP. I’ve followed instructions here. I assume its due to clangd
. I have a couple errors, but the code compiles correctly and it works. I was testing with the blinky example:
#include "Arduino.h"
/*
* Blink
* Turns on an LED on for one second,
* then off for one second, repeatedly.
*/
void setup() {
// initialize LED digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// turn the LED on (HIGH is the voltage level)
digitalWrite(LED_BUILTIN, HIGH);
// wait for a second
delay(2000);
// turn the LED off by making the voltage LOW
digitalWrite(LED_BUILTIN, LOW);
// wait for a second
delay(1000);
}
The error that I get is: In included file: typedef redefinition with different types ('unsigned long long' vs '__uint64_t' (aka 'unsigned long'))
. I also have this additional information from the LSP:
In included file: typedef redefinition with different types ('unsigned long long' vs '__uint64_t' (aka 'unsigned long'))
c_types.h(36, 29): Error occurred here
types.h(161, 20): Previous definition is here
Arduino.h /home/tlepine/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h
From my understanding, clangd
imports definition from types.h
(/usr/include/sys
), but then re-imports the definition from c_types
(/home/user/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include
) which makes the types overlap?
I also have many other errors with unknown arguments, like Unknown argument '-mlongcalls'; did you mean '-mlong-calls'?
or Unknown argument: '-mtext-section-literals'
. I’m able to remove these errors by replacing commands inside the compile_commands.json
, but since this is generated this won’t do. I added .clangd
with the content:
CompileFlags:
Remove:
- -fipa-pta
- -mlongcalls
- -free
- -mtext-section-literals
and the errors were gone, but I don’t know if this is bad practice. If it is, what solution do I have?
Thanks,
Tristan