[Solved] CMAKE how to use typedef enum declared in component

User avatar
gunar.kroeger
Posts: 142
Joined: Fri Jul 27, 2018 6:48 pm

[Solved] CMAKE how to use typedef enum declared in component

Postby gunar.kroeger » Wed Mar 04, 2020 1:01 pm

Hi,

I have a component with a header file "include/Config.h" which declares:

Code: Select all

typedef enum {
	HW_VERSION_UNDEFINED = 0,
	HW_VERSION_1,				//green PCB
	HW_VERSION_2,				//yellow PCB
	HW_VERSION_3,				//navy PCB
	HW_VERSIONS_SIZE,
}HW_Versions;
in main.c, I am including Config.h, with no compilation errors. But when I try to use the define

Code: Select all

ESP_LOGI(TAG, "%d", HW_VERSION_UNDEFINED)
I get an error 'HW_VERSION_UNDEFINED' undeclared (first use in this function);

Should I add something to some CMakeLists.txt to make this variable declared?
Last edited by gunar.kroeger on Wed Mar 04, 2020 5:01 pm, edited 1 time in total.
"Running was invented in 1612 by Thomas Running when he tried to walk twice at the same time."

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

Re: CMAKE how to use typedef enum declared in component

Postby username » Wed Mar 04, 2020 2:09 pm

That is because there is already a file config.h in the file system. Even though you rename it to Config.h (Capital "C") does not matter.

Renaming it to say "Config_mine.h" works for me.

User avatar
gunar.kroeger
Posts: 142
Joined: Fri Jul 27, 2018 6:48 pm

Re: CMAKE how to use typedef enum declared in component

Postby gunar.kroeger » Wed Mar 04, 2020 5:01 pm

works for me as well! thanks
"Running was invented in 1612 by Thomas Running when he tried to walk twice at the same time."

Who is online

Users browsing this forum: Bing [Bot] and 16 guests