Help needed: clangd in VSCode with ESP-IDF reports printf function not found error

1403847775@qq.com
Posts: 4
Joined: Wed Nov 22, 2023 1:15 am

Help needed: clangd in VSCode with ESP-IDF reports printf function not found error

Postby 1403847775@qq.com » Wed Sep 24, 2025 3:43 am

The following is the complete source code, which compiles successfully but triggers errors in clangd.
#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#define OUT_GPIO GPIO_NUM_15
#define OUT_MASK (1ULL<<OUT_GPIO)

void app_main(void)
{
gpio_config_t io_conf={OUT_MASK,GPIO_MODE_OUTPUT,GPIO_PULLUP_DISABLE,GPIO_PULLDOWN_DISABLE,GPIO_INTR_DISABLE};
gpio_config(&io_conf);
while(true)
{
gpio_set_level(OUT_GPIO, 1);
vTaskDelay(1000/portTICK_PERIOD_MS);
printf("输出一\n");
gpio_set_level(OUT_GPIO, 0);
vTaskDelay(1000/portTICK_PERIOD_MS);
printf("输出零\n");
}
}
Attachments
无标题.png
无标题.png (76.69 KiB) Viewed 407 times
printf.jpg
printf.jpg (158.03 KiB) Viewed 407 times

MicroController
Posts: 2669
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Help needed: clangd in VSCode with ESP-IDF reports printf function not found error

Postby MicroController » Wed Sep 24, 2025 9:27 am

Try adding #include <stdio.h>.

1403847775@qq.com
Posts: 4
Joined: Wed Nov 22, 2023 1:15 am

Re: Help needed: clangd in VSCode with ESP-IDF reports printf function not found error

Postby 1403847775@qq.com » Thu Sep 25, 2025 8:58 am

Try adding #include <stdio.h>.
I've already attempted this, yet clangd persists in reporting 'printf function not found'.
Attachments
include.png
include.png (79.83 KiB) Viewed 382 times

Who is online

Users browsing this forum: Applebot, Qwantbot, Semrush [Bot] and 3 guests