platformio-vscode-ide: identifier "uint8_t" is undefined
I get all uint8_t and uint16_t declarations marked as errors with identifier "uint8_t" is undefined in my platformio-project for an ESP8266. It can easily be reproduced: Just generate a new project for an esp8266 board, choose arduino as framework and type uint8_t x = 3 somewhere. It will hilight uint8_t and tell its an undefined identifier.
This does not happen on AVR projects for example.
I spend quite some time to debug this issue and found this line be responsible in my c_cpp_properties.json at the includePath array:
"/home/jan/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/4.8.2/include-fixed",
Deleting this fixes the issue.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 24 (5 by maintainers)
Guys, please open PIO IDE Terminal and type
pio upgrade. Starting from PIO Core 3.5.0rc6 we will generate built-in GCC macros for configuration files.All should work now.
I’ve done some digging into the stdint.h and limits.h and traced the error down to missing definitions of
__SCHAR_MAX__and__SHRT_MAX__in theincludes-fixed/limits.h. These are defined inside the xtensa gcc and the IntelliSense engine doesn’t find them. The workaround I’ve found is to addto the
defines: [ ... ]section of thec_cpp_properties.jsonfile. With this change you can reset theC_Cpp.intelliSenseEngineback toDefaultwithout getting the error.You can print all built-in defines with the following command in Powershell:
PS C:\Users\<yourname>\.platformio\packages\toolchain-xtensa\bin> echo $null | .\xtensa-lx106-elf-gcc.exe -dM -E -For me it works. All is good now.
@Dee-Fuse It sounds like you guys tracked down the missing define. The cpptools extension doesn’t regenerate the c_cpp_properties.json. I think it’s the platformio extension – I think they shouldn’t overwrite an existing c_cpp_properties.json and should rely on users deleting the file if they want the extension to auto-generate a new one.
Ah, yeah, I also hit this issue. I’ll let you know what I find out…