Page 1 of 1

(solved) using VS Code, build can't find uart.h

Posted: Mon Sep 27, 2021 5:02 pm
by mzimmers
Hi all -

I'm still working my way through the nuances of using the VS Code IDE. I tried adding an include to uart.h to a header file, and it gives an error that the file isn't found.

The build works without error using idf.py.

All the other ESP-IDF header files are found:

Code: Select all

#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "esp_crt_bundle.h"
#include "lwip/ip_addr.h"
#include "esp_wifi_types.h"
#include "esp_http_server.h"
#include "uart.h"
I only get an error on uart.h. Is there something special about the drivers directories that requires me to do something extra for this file to be found?

Thanks...

Re: using VS Code, build can't find uart.h

Posted: Mon Sep 27, 2021 6:17 pm
by chegewara
This time it is esp-idf nuance. File with name "uart.h" actually exists, but it is hidden in subfolder:
https://github.com/espressif/esp-idf/tr ... ude/driver

Now, when you look at esp-idf example, you can see how include for such header file should look like:
https://github.com/espressif/esp-idf/bl ... .c#L12-L13

Re: using VS Code, build can't find uart.h

Posted: Mon Sep 27, 2021 6:21 pm
by mzimmers
Hi chegewara -

I sort of thought it might be something like that (I tried a few combinations, but not of mine worked). So, why did my build work using idf.py?

Re: using VS Code, build can't find uart.h

Posted: Mon Sep 27, 2021 6:29 pm
by chegewara
Actually it should not build if you include just "uart.h, it has to be "driver/uart.h".

With VS code is different problem. esp-idf is massive API and VS code should warn you that some files are not indexed.

What i do when i work with esp-idf is just add it to workspace next to project, but not copy folder, just add to workspace. It helps to search for functions declaration/definition and if VS code cant handle it i am just using CTRL + SHIFT + F to search all files.
Also keeping espressif docs website open also helps a lot.

Re: using VS Code, build can't find uart.h

Posted: Mon Sep 27, 2021 6:37 pm
by mzimmers
chegewara wrote:
Mon Sep 27, 2021 6:29 pm
Also keeping espressif docs website open also helps a lot.
That's for sure. Thanks, chegewara.