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

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

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

Postby mzimmers » Mon Sep 27, 2021 5:02 pm

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...
Last edited by mzimmers on Mon Sep 27, 2021 6:37 pm, edited 1 time in total.

chegewara
Posts: 2210
Joined: Wed Jun 14, 2017 9:00 pm

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

Postby chegewara » Mon Sep 27, 2021 6:17 pm

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

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

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

Postby mzimmers » Mon Sep 27, 2021 6:21 pm

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?

chegewara
Posts: 2210
Joined: Wed Jun 14, 2017 9:00 pm

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

Postby chegewara » Mon Sep 27, 2021 6:29 pm

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.

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

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

Postby mzimmers » Mon Sep 27, 2021 6:37 pm

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.

Who is online

Users browsing this forum: No registered users and 24 guests