在 ESP IDF 编译器中包含一个 header 文件

Including a header file in ESP IDF compiler

我正在尝试 运行 来自 esp 的示例项目,它在单芯片示例下,克隆自 https://github.com/espressif/esp-who

其识别示例。我包括一个 esp_http_client.h 但找不到它。

还有一个CMkakeLists.txt和Makefile。 我的第一个问题是,我是否必须编辑其中一个文件以包含 header,或者我必须在 gcc.conf 中添加目录路径? 如果是这样,我该怎么做。

非常感谢。

您需要指定 non-default 个组件作为要求,在您的情况下 esp_http_client。默认组件由 IDF 自动添加,可在此处找到列表:https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html?highlight=default%20component#common-component-requirements

如果可以,请使用cmake。可以在此处找到如何添加组件的说明:https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html?highlight=default%20component#component-requirements.

另一种简单的方法是查看 esp_http_client 示例。我为所有 idf 示例使用了一个“通用”组件,这可能足以开始:https://github.com/espressif/esp-idf/tree/master/examples/protocols/esp_http_client.

干杯。