Based on the esp32 IDF development of VS CODE, some functions cannot jump

This article is not about the problem that the header file cannot be found, but about the problem that some functions in the component cannot jump to the source file (if the header file cannot be found, please refer to https://blog.csdn.net/weixin_42131637/article/details /121726213 (most of the time this method needs to reconfigure your own environment, the editor’s environment is already very chaotic, so there are still some header files that cannot be found, Xiaobai recommends not to configure randomly), or directly use vs directly generated by the ESP-IDF explorer tool in the code)

Many users who develop ESP32 have used the ESP-IDF explorer tool in vs code to generate projects. At this time, most of the functions needed in the project can jump, and run normally, and the header files can also be found. However, there are still Some functions or macro definitions can be used normally, and other people can find the definitions on the Internet, but it shows that the definition of "xxxxx" cannot be found. For this reason, the editor has been troubled for a long time, and then found a solution, but patients with obsessive-compulsive disorder are advised not to use the following methods.

First, because we will automatically download the SDK package when we install the ESP-IDE tool, we first find the code package location esp-idf-v5.0.1 in the installation location of the ESP-IDE tool (as shown in the figure)

In fact, we can also take the SDK package out of it and create a separate folder, but it will be troublesome to jump every time, so it is recommended to put it in the SDK package of the tool chain. Or modify the actual location of the toolchain. As shown in the picture:

There are two pitfalls here: 1. At this time, if you find the sdk package difficult to find and modify the folder name of the upper layer of the tool chain, then the ESP-IDF tool will not be available (it is recommended not to modify it if you do not know how to configure it yourself) 2. Tools The starting position of the chain and the code package cannot be saved in two different computer disks, because the root directory is the computer disk (C:\;D:\...), tools cannot jump across disks

Then we create our own project folder under the code package folder

Then find the demo you want under example

Copy the demo you choose to your own project folder, and the project creation is basically completed at this time

Edit at this time, use vs code to open the entire SDK package (2 problems will appear at this time)

  1. The header file will turn red again, I suggest you ignore it

  1. At this time, the loading of the project is slow, but there may still be cases where the function cannot be found. If you cannot jump, search on the left side. If you can’t find it, search it several times. computer performance, the better the computer, the easier it is to find).

Or, just jump to the header file first, and then find the source file (a c file with a similar name to the h file, which can be quickly searched by opening it)

At this point, the file can be redirected normally without affecting the use (of course, it cannot be compiled with vs code).

At this time, for the compilation of the project, use the ESP-IDF 5.0 CMD tool. After opening, since the SDK package directory is the starting location, you only need to open the newly created folder to find the CMakeLists.txt of the corresponding project after the tool initialization is completed. Run idf.py build in the folder of the same level to compile, then burn and view

Guess you like

Origin blog.csdn.net/m0_45068979/article/details/131305810