Page 1 of 1

header file of class and problem of including esp32 components

Posted: Wed May 20, 2020 12:11 am
by kyrpav
i have a c++ project and i want to control a motor. I created a class (.h and .cpp files separated) that should implement the mcpwm.

I can include the "driver/mcpwm.h" in the .cpp file but in the .h file (where i want to declare some variables and the functions) the autocomplete does not find driver folder so the header can not be included.

Re: header file of class and problem of including esp32 components

Posted: Wed May 20, 2020 1:14 pm
by PeterR

Code: Select all

the autocomplete does not find driver folder
Autocomplete?

Usually you just:
#include "mcpwm.h"

Might help to quote your IDF version, makefile etc.

Re: header file of class and problem of including esp32 components

Posted: Wed May 20, 2020 7:51 pm
by kyrpav
IDF version 4.2

makefile is :

Code: Select all

cmake_minimum_required(VERSION 3.5)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(motors)

when i say autocomplete is that when i write

Code: Select all

#include ""
i can use ctl+space to give me the available headers as i am writing inside quotes.
Index is rebuild but it is not resolved. I can do it normally in .cpp file where i allows me to add

Code: Select all

#include "driver/mcpwm.h"
but not in .h file.

As you can imagine i can not create an mcpwm_unit_t cause type can not be resolved (again in .h file)

Re: header file of class and problem of including esp32 components

Posted: Wed May 20, 2020 11:55 pm
by PeterR
What IDE are you using and how is it setup?

It is nice to have a well setup IDE but sometimes you can over sweat this stuff and good old typing is quicker ;)

Re: header file of class and problem of including esp32 components

Posted: Fri May 22, 2020 6:45 am
by kyrpav
IDE is Eclipse 2020-03 and installation is done with the latest plugin version. System is Debian.

Used a blink example and changed the .c to .cpp and the makefile in proper way. I is working normally with other classes that i have separate .h and .cpp file.

I just can not include the components headers to the .h files.