I am facing an issue converting gatt_server example to cpp.
Steps to replicate the error:
Step 1:
I copied gatt_server directory to another directory.
Step 2:
I added
extern "C"
{
void app_main();
}
to the gatt_server.c and renamed it gatt_server.cpp
Step 3:
I built the project as
idf.py build.
I get a lot of error messages like [See the attachment for the build log to know all the errors.]
"crosses initialization of 'esp_err_t add_char_ret'"
./main/main.cpp:305:12: error: enumeration value 'ESP_GATTS_WRITE_EVT' not handled in switch [-Werror=switch]
../main/main.cpp:305:12: error: enumeration value 'ESP_GATTS_EXEC_WRITE_EVT' not handled in switch [-Werror=switch]
../main/main.cpp:305:12: error: enumeration value 'ESP_GATTS_MTU_EVT' not handled in switch [-Werror=switch]
../main/main.cpp:305:12: error: enumeration value 'ESP_GATTS_CONF_EVT' not handled in switch [-Werror=switch]
etc.
I want to know if there is any example cpp project that can be provided?
If not please guide me into removing these errors.
I know that this answers the cross initialization erros:
https://stackoverflow.com/questions/115 ... tion-error
I want to understand the rest.
Need help converting GATT_Server example in ESP-IDF to CPP
-
- Posts: 10
- Joined: Tue Nov 09, 2021 5:43 am
Need help converting GATT_Server example in ESP-IDF to CPP
- Attachments
-
- errorLog.txt
- Error Log
- (35.69 KiB) Downloaded 241 times
-
- Posts: 10
- Joined: Tue Nov 09, 2021 5:43 am
Re: Need help converting GATT_Server example in ESP-IDF to CPP
I solved this issue by adding break to the case statements.
Cross initialization was avoided by following the tip in the link above:
switch(k)
{
case 1:
{
int t = 4;
}
break;
default:
break;
}
Cross initialization was avoided by following the tip in the link above:
switch(k)
{
case 1:
{
int t = 4;
}
break;
default:
break;
}
Who is online
Users browsing this forum: atx823 and 77 guests