#include errors detected

Hello,

since days I am trying to get an external library installed via the library manager to work. But there is alway an #include error detected.
The installation of the library is sucessfull and in the platformio.ini the library is recognized.

What I figured out is, that this kind of problem occur very often and I read a many topics, the documentation and watched videos and I don’t figured out what is the problem in my case.

When I inspect the main.c in the PlatformIO Home I got this output:

PIO Core Call Error: "Processing esp32dev (platform: espressif32; board: esp32dev; framework: espidf)\r\n--------------------------------------------------------------------------------\r\nVerbose mode can be enabled via `-v, --verbose` option\r\nCONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html\r\nPLATFORM: Espressif 32 (3.5.0) > Espressif ESP32 Dev Module\r\nHARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash\r\nDEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)\r\nPACKAGES: \r\n - framework-espidf 3.40302.0 (4.3.2) \r\n - tool-cmake 3.16.4 \r\n - tool-esptoolpy 1.30100.210531 (3.1.0) \r\n - tool-idf 1.0.1 \r\n - tool-mconf 1.4060000.20190628 (406.0.0) \r\n - tool-ninja 1.9.0 \r\n - toolchain-esp32ulp 1.22851.191205 (2.28.51) \r\n - toolchain-riscv32-esp 8.4.0+2021r2-patch2 \r\n - toolchain-xtensa-esp32 8.4.0+2021r2-patch2 \r\n - toolchain-xtensa-esp32s2 8.4.0+2021r2-patch2\r\nReading CMake configuration...\r\nLDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf\r\nLDF Modes: Finder ~ chain, Compatibility ~ soft\r\nFound 0 compatible libraries\r\nScanning dependencies...\r\nNo dependencies\r\nBuilding in debug mode\r\nCompiling .pio\\build\\esp32dev\\src\\main.o\r\nCompiling .pio\\build\\esp32dev\\bootloader_support\\src\\flash_partitions.o\r\nCompiling .pio\\build\\esp32dev\\bootloader_support\\src\\flash_qio_mode.o\r\nCompiling .pio\\build\\esp32dev\\bootloader_support\\src\\bootloader_flash_config_esp32.o\r\nCompiling .pio\\build\\esp32dev\\bootloader_support\\src\\bootloader_efuse_esp32.o\r\nCompiling .pio\\build\\esp32dev\\bootloader_support\\src\\idf\\bootloader_sha.o\r\nCompiling .pio\\build\\esp32dev\\cbor\\tinycbor\\src\\cborencoder_close_container_checked.o\r\nCompiling .pio\\build\\esp32dev\\cbor\\tinycbor\\src\\cborencoder.o\r\nCompiling .pio\\build\\esp32dev\\cbor\\tinycbor\\src\\cborerrorstrings.o\r\nCompiling .pio\\build\\esp32dev\\cbor\\tinycbor\\src\\cborparser_dup_string.o\r\nCompiling .pio\\build\\esp32dev\\cbor\\tinycbor\\src\\cborparser.o\r\nCompiling .pio\\build\\esp32dev\\cbor\\tinycbor\\src\\cborpretty_stdio.o\r\n\n\nsrc/main.c:7:10: fatal error: U8g2lib.h: No such file or directory\r\n\r\n*****************************************************************\r\n* Looking for U8g2lib.h dependency? Check our library registry!\r\n*\r\n* CLI > platformio lib search \"header:U8g2lib.h\"\r\n* Web > https://registry.platformio.org/search?q=header:U8g2lib.h\r\n*\r\n*****************************************************************\r\n\r\n #include <U8g2lib.h>\r\n ^~~~~~~~~~~\r\ncompilation terminated.\r\n*** [.pio\\build\\esp32dev\\src\\main.o] Error 1\r\n========================== [FAILED] Took 6.56 seconds =========================="

The platformio.ini

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = espidf
lib_deps = 
  olikraus/U8g2@^2.32.10

The main.c

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
#include "driver/gpio.h"

#include <U8g2lib.h>
// #include "U8g2lib.h"

#define BLINK_LED 2

void app_main(void)
{
  char *ourTaskName = pcTaskGetName(NULL);
  ESP_LOGI(ourTaskName, "Starting...\n");
  gpio_reset_pin(BLINK_LED);
  gpio_set_direction(BLINK_LED, GPIO_MODE_OUTPUT);

  while (1)
  {
    gpio_set_level(BLINK_LED, 1);
    printf("Turning on the LED\n");
    vTaskDelay(500 / portTICK_PERIOD_MS);
    printf("Turning off the LED\n");
    gpio_set_level(BLINK_LED, 0);
    vTaskDelay(2500 / portTICK_PERIOD_MS);
  }
}

I would be very thankful if anybody has a hint for to figure out where the problem is.

Edit:
The IntelliSense Index is rebuild and what I also figured out, after the rebuild there is an error in the c_cpp_properties.json but when I open the file the error is gone.

The same issue in my case. Works fine with framework=arduino, fails with framework=stm32cube