Compilation error with Zephyr using C++ for stm nucelo board

Hi,
I would like to develop my embedded software in c++20 (using STL such as vector, map, list, etc..) for stm nucleo board F466RE.
The project builds succesfully.

Memory region         Used Size  Region Size  %age Used
           FLASH:      112716 B       512 KB     21.50%
             RAM:       14080 B       128 KB     10.74%
     BACKUP_SRAM:          0 GB         4 KB      0.00%
        IDT_LIST:          0 GB        32 KB      0.00%
Checking size .pio/build/nucleo_f446re/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  10.7% (used 14061 bytes from 131072 bytes)
Flash: [==        ]  20.6% (used 107972 bytes from 524288 bytes)
Building .pio/build/nucleo_f446re/firmware.bin

But the compiler throws the error: ‘vector’ file not found.

Screenshot 2025-11-03 at 12.09.20

Main.cpp

extern "C"{
    #include <zephyr/kernel.h>
    #include <zephyr/device.h>
    #include <zephyr/devicetree.h>
    #include <zephyr/drivers/pwm.h>
    #include <zephyr/drivers/gpio.h>
}

#include <vector>

#define MOTORS_NODE DT_NODELABEL(motors_)
    
int main() {

std::vector<int> test;

   while (true) {
        k_msleep(1000);
        
    }
   return 0;
}
    

.ini file

[env:nucleo_f446re]
platform = ststm32
board = nucleo_f446re
framework = zephyr
build_type = debug
upload_protocol = stlink
extra_scripts = no_atexit.py

build_flags =
    -std=gnu++20
    -std=c++20
    -fexceptions

build_unflags =
    -std=gnu++11 #only use c++20
    -nostdinc

prj.conf


# Enable C++ and new stdlib and c++20 features
CONFIG_CPP=y
CONFIG_NEWLIB_LIBC=y
CONFIG_GLIBCXX_LIBCPP=y
CONFIG_STD_CPP20=y
CONFIG_REQUIRES_FULL_LIBCPP=y
CONFIG_CPP_EXCEPTIONS=y
CONFIG_CPP_RTTI=n

# Threading and memory
CONFIG_MAIN_STACK_SIZE=5000
CONFIG_HEAP_MEM_POOL_SIZE=1024
CONFIG_THREAD_STACK_INFO=y
CONFIG_THREAD_MONITOR=y
CONFIG_TIMESLICING=y
CONFIG_MULTITHREADING=y

# Drivers
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_PWM=y
CONFIG_PWM_STM32=y

# Logging
CONFIG_LOG=y
CONFIG_CONSOLE=y
CONFIG_LOG_DEFAULT_LEVEL=3 

CMakeLists.txt

cmake_minimum_required(VERSION 3.20.0)
set(DTC_OVERLAY_FILE ../nucleo_f446re.overlay)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(Zephyr_RTOS_STM-nucleo)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CONFIG_LIB_CPP ON)
set(CONFIG_NEWLIB_LIBC ON)

FILE(GLOB app_sources ../src/*.c*)
target_sources(app PRIVATE ${app_sources})
target_compile_options(app PRIVATE -fexceptions)

No, the IDE intellisense doesn’t find it. The build works.

clang(d) is not the intended intellisense provider with the PlatformIO extension: Microsoft C/C++ is. So what clang extension as your intellisense or linter do you have installed and how do you have it configured?

In the configuration page the intellisense mode is set to default (meaning it’s using macos-clang-x64)
Here are the info from log diagnostic:

{
    "configurations": [
        {
            "name": "PlatformIO",
            "includePath": [
                Version: 1.28.3
Current Configuration:
{
    "name": "PlatformIO",
    "includePath": [
        "/Users/danilomessina/Documents/GIT_repository/robot/Projects/Zephyr_RTOS_STM-nucleo/include",
        "/Users/danilomessina/Documents/GIT_repository/robot/Projects/Zephyr_RTOS_STM-nucleo/src",
        "/Users/danilomessina/Documents/GIT_repository/robot/Projects/Zephyr_RTOS_STM-nucleo/.pio/build/nucleo_f446re/zephyr/include/generated/zephyr",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/include",
        "/Users/danilomessina/Documents/GIT_repository/robot/Projects/Zephyr_RTOS_STM-nucleo/.pio/build/nucleo_f446re/zephyr/include/generated",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/soc/st/stm32",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/lib/libc/newlib/include",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/soc/st/stm32/common",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/drivers",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/soc/st/stm32/stm32f4x",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/_pio/modules/hal/cmsis/CMSIS/Core/Include",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/_pio/modules/hal/cmsis_6/CMSIS/Core/Include",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/modules/cmsis_6",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/_pio/modules/hal/stm32/stm32cube/stm32f4xx/soc",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/_pio/modules/hal/stm32/stm32cube/stm32f4xx/drivers/include",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/_pio/modules/hal/stm32/stm32cube/common_ll/include",
        "/Users/danilomessina/Documents/GIT_repository/robot/Projects/Zephyr_RTOS_STM-nucleo/.pio/libdeps/nucleo_f446re/Unity/src"
    ],
    "browse": {
        "limitSymbolsToIncludedHeaders": true,
        "path": [
            "/Users/danilomessina/Documents/GIT_repository/robot/Projects/Zephyr_RTOS_STM-nucleo/include",
            "/Users/danilomessina/Documents/GIT_repository/robot/Projects/Zephyr_RTOS_STM-nucleo/src",
            "/Users/danilomessina/Documents/GIT_repository/robot/Projects/Zephyr_RTOS_STM-nucleo/.pio/build/nucleo_f446re/zephyr/include/generated/zephyr",
            "/Users/danilomessina/.platformio/packages/framework-zephyr/include",
            "/Users/danilomessina/Documents/GIT_repository/robot/Projects/Zephyr_RTOS_STM-nucleo/.pio/build/nucleo_f446re/zephyr/include/generated",
            "/Users/danilomessina/.platformio/packages/framework-zephyr/soc/st/stm32",
            "/Users/danilomessina/.platformio/packages/framework-zephyr/lib/libc/newlib/include",
            "/Users/danilomessina/.platformio/packages/framework-zephyr/soc/st/stm32/common",
            "/Users/danilomessina/.platformio/packages/framework-zephyr/drivers",
            "/Users/danilomessina/.platformio/packages/framework-zephyr/soc/st/stm32/stm32f4x",
            "/Users/danilomessina/.platformio/packages/framework-zephyr/_pio/modules/hal/cmsis/CMSIS/Core/Include",
            "/Users/danilomessina/.platformio/packages/framework-zephyr/_pio/modules/hal/cmsis_6/CMSIS/Core/Include",
            "/Users/danilomessina/.platformio/packages/framework-zephyr/modules/cmsis_6",
            "/Users/danilomessina/.platformio/packages/framework-zephyr/_pio/modules/hal/stm32/stm32cube/stm32f4xx/soc",
            "/Users/danilomessina/.platformio/packages/framework-zephyr/_pio/modules/hal/stm32/stm32cube/stm32f4xx/drivers/include",
            "/Users/danilomessina/.platformio/packages/framework-zephyr/_pio/modules/hal/stm32/stm32cube/common_ll/include",
            "/Users/danilomessina/Documents/GIT_repository/robot/Projects/Zephyr_RTOS_STM-nucleo/.pio/libdeps/nucleo_f446re/Unity/src"
        ]
    },
    "defines": [
        "PLATFORMIO=60118",
        "STM32F4",
        "STM32F446xx",
        "CORE_CM4",
        "HSE_VALUE=8000000",
        "KERNEL",
        "K_HEAP_MEM_POOL_SIZE=1024",
        "STM32F446xx",
        "USE_FULL_LL_DRIVER",
        "USE_HAL_DRIVER",
        "_ANSI_SOURCE",
        "__LINUX_ERRNO_EXTENSIONS__",
        "__PROGRAM_START",
        "__ZEPHYR__=1",
        "__PLATFORMIO_BUILD_DEBUG__",
        ""
    ],
    "cStandard": "c99",
    "cppStandard": "c++20",
    "forcedInclude": [
        "/Users/danilomessina/Documents/GIT_repository/robot/Projects/Zephyr_RTOS_STM-nucleo/.pio/build/nucleo_f446re/zephyr/include/generated/zephyr/autoconf.h",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/include/zephyr/toolchain/zephyr_stdint.h"
    ],
    "compilerPath": "/Users/danilomessina/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc",
    "compilerArgs": [
        "-mcpu=cortex-m4",
        "-mthumb",
        "-mabi=aapcs",
        "-mfp16-format=ieee",
        "-isystem",
        "/Users/danilomessina/.platformio/packages/framework-zephyr/lib/libc/common/include",
        ""
    ],
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": false,
    "recursiveIncludesReduceIsExplicit": false,
    "recursiveIncludesPriorityIsExplicit": false,
    "recursiveIncludesOrderIsExplicit": false,
    "compilerPathInCppPropertiesJson": "/Users/danilomessina/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc",
    "mergeConfigurations": false,
    "recursiveIncludes": {}
}
Modified Settings:
{
    "C_Cpp.errorSquiggles": "disabled",
    "C_Cpp.default.compilerPath": "/Users/danilomessina/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc",
    "C_Cpp.loggingLevel": "Information"
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {},
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.28.3.0
Current database path: /Users/danilomessina/Library/Caches/vscode-cpptools/e1164c6d0370f3e3bc3857e0a929a2ab/.browse.VC.db
No active translation units.