PlatformIO IDE compiles correctly but reports uint8_t not defined

This is my first project using platformio (and the PlatformIO IDE) using mbed and I am running into the issue that the terminal window reports that the build was successful, but the problems tab reports that uint8_t isn’t defined as a type. Normally I would expect this if the compiler wasn’t configured correctly and all the standard types wouldn’t be defined.

Here it is interesting because at least some of the standard int types are defined and it is a confusion hodgepodge:

  • int8_t Works
  • uint8_t Error
  • int16_t Works
  • uint16_t Works
  • int32_t Works
  • uint32_t Error

I can’t simply ignore it because the actual codebase is many thousands of lines long and uses all of the aforementioned types (and more). Trying to wade through what is and isn’t actually an error would be impractical in the least

Addendum: I just tried the same project using eclipse and it doesn’t display the same issue

My Environment:

  • macOS: 10.13.6
  • PlatformIO Core 3.6.2rc1
  • framework: mbed;
  • platform: nordicnrf52;
  • board: nrf52_dk

My Code:

#include "mbed.h"
#include <stdint.h>

DigitalOut led1(P0_23);

int main() {
    uint8_t foo;;
    while (true) {
        led1 = !led1;
        wait(0.7);
        ++foo;
    }
}

My Errors:

  • expected a ‘;’ (7,13)
  • identifier “foo” is undefined (11, 11)

Please update PlatformIO IDE extension for VSCode to the latest version. Should be fixed in

I had the same issue, the problem was a localized output of gcc: identifier "uint8_t" is undefined · Issue #3026 · microsoft/vscode-cpptools · GitHub
They will fix it soon

The very same problem happens again with PlatformIO 6.1.3

There are identifier "uint8_t" is undefined errors in my old code for ESP32 cam and compile is without errors.