using esp_timer_cxx.hpp

zamek42@gmail.com
Posts: 34
Joined: Sat Dec 02, 2017 7:27 pm

using esp_timer_cxx.hpp

Postby zamek42@gmail.com » Wed Apr 27, 2022 7:03 am

Hi ALl,
I would like to create a project with cpp and I need to use timers, but I cannot use this file. My root CMakelist.txt contains this:

cmake_minimum_required(VERSION 3.5)
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/examples/cxx/experimental/experimental_cpp_component")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(MyTestProject)

and my main/CMakelists.txt is:

idf_component_register(SRCS
"main.cpp"
"control.cpp"
INCLUDE_DIRS "."
REQUIRES nvs_flash json pthread esp_timer driver esp_event)

in config I enabled the compiler options/Enable C++ exceptions option.

in my control.h ther is:

#include "esp_exception.hpp"
#include "esp_timer_cxx.hpp"

compiler said:
esp_exception.hpp: No such file or directory
esp_timer_cxx.hpp: No such file or directory

How can I use timers?

thx,
Zamek

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: using esp_timer_cxx.hpp

Postby ESP_igrr » Wed Apr 27, 2022 11:24 am

Hi Zamek,

I think it will work if you add experimental_cpp_component to the REQUIRES list in idf_component_register.

(When you add experimental_cpp_component to EXTRA_COMPONENT_DIRS, this adds the component to the project. To let the build system know that your "main" component is using experimental_cpp_component, you need to list it in PRIV_REQUIRES or REQUIRES list)

zamek42@gmail.com
Posts: 34
Joined: Sat Dec 02, 2017 7:27 pm

Re: using esp_timer_cxx.hpp

Postby zamek42@gmail.com » Mon May 02, 2022 6:16 am

Hi ESP_igrr,

It is part of my CMakelists.txt :
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/examples/cxx/experimental/experimental_cpp_component")
but it is not enough. :(

thx
Zamek

zamek42@gmail.com
Posts: 34
Joined: Sat Dec 02, 2017 7:27 pm

Re: using esp_timer_cxx.hpp

Postby zamek42@gmail.com » Mon May 02, 2022 7:21 am

Hi All,

Finally that was the needed config line in main/CMakeLists.txt:
PRIV_REQUIRES "experimental_cpp_component"

thx
Zamek

Who is online

Users browsing this forum: No registered users and 104 guests