fundamaental work of #include in VSCode

hape65
Posts: 8
Joined: Wed Apr 03, 2024 4:41 pm

fundamaental work of #include in VSCode

Postby hape65 » Fri Apr 19, 2024 8:32 am

hi
i have read a lot of material in the WEB. But i didn't find an answer to one question.
If i want to add to a project example another feature like i have softap_example choosen - so it works.
Now i want to add also bluetooth to this code.
If i try to
#include "esp_bt.h"
it doesn't work (and i found a lot of this questions but no answer how it works) with #include errors detected.
If i make project out of the bluetooth examples the
#include "esp_bt.h"
works! (bt_hid_mouse_device)
So there must be a trick how to configure some .json configure files (or something magic) that intellisense and the compiler found this folders.
Do you know how to "add" this features. It isn't so easy because for example the esp_bt.h is in more than one folder:
under the /esp-idf/vomponents/bt
are folders for esp32 - esp32c2 - esp32c3 - esp32c5 - esp32h2 - esp32h4
and there is a include folder which contains the esp_bt.h

So i don't understand where to add what that 1. Intellisense find this folder if i want to add bluetooth 2. that it is the right folder for the correct chip.

Any videos or explanations of these concepts are very welcome.

regards
hape

username
Posts: 537
Joined: Thu May 03, 2018 1:18 pm

Re: fundamaental work of #include in VSCode

Postby username » Fri Apr 19, 2024 5:23 pm

There should be a file named idf_component.yml

In there you would put your dependencies.

If you look at that bluetooth example, look at the idf_component.yml file, and copy whats in there into your projects idf_component.yml file . It will then pull in the necessary files into your project.

hape65
Posts: 8
Joined: Wed Apr 03, 2024 4:41 pm

Re: fundamaental work of #include in VSCode

Postby hape65 » Mon Apr 22, 2024 1:31 pm

hi
ok thats interesting. On some of the examples is the file you mentioned (idf_component.yml). But on C:\Users\hape\esp\v5.2.1\esp-idf\examples\bluetooth\bluedroid\classic_bt\bt_discovery there isn't any of these files. So there must be another trick. Also the esp_bt.h is there for every ESP32 (C2 C3 C6 etc). So in the whole directory is not 1 .yml file.
Do you know how this magic happens?
regards
hape

Who is online

Users browsing this forum: No registered users and 12 guests