error: expected ‘)’ before ‘PRIx64’

本文提供了解决C++编译时遇到的头文件错误的解决方案,通过在代码中包含stdint.h和inttypes.h两个关键头文件来修复问题。附带链接指向详细的技术讨论。
C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log_color.h:98:31: error: format '%d' expects argument of type 'int', but argument 8 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] 98 | #define LOG_COLOR_E "" | ^~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:62:37: note: in expansion of macro 'LOG_COLOR_E' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:182:86: note: in expansion of macro 'LOG_FORMAT' 182 | if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVE' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:123:13: note: in expansion of macro 'ESP_LOGI' 123 | ESP_LOGI("CMD", "DO%d set to %s for %dms", | ^~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log_color.h:99:31: error: format '%d' expects argument of type 'int', but argument 8 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] 99 | #define LOG_COLOR_W "" | ^~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:62:37: note: in expansion of macro 'LOG_COLOR_W' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:183:86: note: in expansion of macro 'LOG_FORMAT' 183 | else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVE' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:123:13: note: in expansion of macro 'ESP_LOGI' 123 | ESP_LOGI("CMD", "DO%d set to %s for %dms", | ^~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log_color.h:101:31: error: format '%d' expects argument of type 'int', but argument 8 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] 101 | #define LOG_COLOR_D "" | ^~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:62:37: note: in expansion of macro 'LOG_COLOR_D' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:184:86: note: in expansion of macro 'LOG_FORMAT' 184 | else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVE' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:123:13: note: in expansion of macro 'ESP_LOGI' 123 | ESP_LOGI("CMD", "DO%d set to %s for %dms", | ^~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log_color.h:102:31: error: format '%d' expects argument of type 'int', but argument 8 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] 102 | #define LOG_COLOR_V "" | ^~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:62:37: note: in expansion of macro 'LOG_COLOR_V' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:185:86: note: in expansion of macro 'LOG_FORMAT' 185 | else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVE' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:123:13: note: in expansion of macro 'ESP_LOGI' 123 | ESP_LOGI("CMD", "DO%d set to %s for %dms", | ^~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log_color.h:100:31: error: format '%d' expects argument of type 'int', but argument 8 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] 100 | #define LOG_COLOR_I "" | ^~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:62:37: note: in expansion of macro 'LOG_COLOR_I' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:186:86: note: in expansion of macro 'LOG_FORMAT' 186 | else { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVE' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:123:13: note: in expansion of macro 'ESP_LOGI' 123 | ESP_LOGI("CMD", "DO%d set to %s for %dms", | ^~~~~~~~ C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:132:31: error: statement with no effect [-Werror=unused-value] 132 | (uint8_t)(cmd->state.voltage * 255 / 3.3)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:132:72: error: expected ';' before ')' token 132 | (uint8_t)(cmd->state.voltage * 255 / 3.3)); | ^ | ; C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:132:72: error: expected statement before ')' token C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log_color.h:98:31: error: format '%d' expects argument of type 'int', but argument 8 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] 98 | #define LOG_COLOR_E "" | ^~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:62:37: note: in expansion of macro 'LOG_COLOR_E' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:182:86: note: in expansion of macro 'LOG_FORMAT' 182 | if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVE' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:133:13: note: in expansion of macro 'ESP_LOGI' 133 | ESP_LOGI("CMD", "AO%d set to %.2fV for %dms", | ^~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log_color.h:99:31: error: format '%d' expects argument of type 'int', but argument 8 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] 99 | #define LOG_COLOR_W "" | ^~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:62:37: note: in expansion of macro 'LOG_COLOR_W' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:183:86: note: in expansion of macro 'LOG_FORMAT' 183 | else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVE' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:133:13: note: in expansion of macro 'ESP_LOGI' 133 | ESP_LOGI("CMD", "AO%d set to %.2fV for %dms", | ^~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log_color.h:101:31: error: format '%d' expects argument of type 'int', but argument 8 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] 101 | #define LOG_COLOR_D "" | ^~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:62:37: note: in expansion of macro 'LOG_COLOR_D' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:184:86: note: in expansion of macro 'LOG_FORMAT' 184 | else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVE' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:133:13: note: in expansion of macro 'ESP_LOGI' 133 | ESP_LOGI("CMD", "AO%d set to %.2fV for %dms", | ^~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log_color.h:102:31: error: format '%d' expects argument of type 'int', but argument 8 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] 102 | #define LOG_COLOR_V "" | ^~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:62:37: note: in expansion of macro 'LOG_COLOR_V' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:185:86: note: in expansion of macro 'LOG_FORMAT' 185 | else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVE' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:133:13: note: in expansion of macro 'ESP_LOGI' 133 | ESP_LOGI("CMD", "AO%d set to %.2fV for %dms", | ^~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log_color.h:100:31: error: format '%d' expects argument of type 'int', but argument 8 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] 100 | #define LOG_COLOR_I "" | ^~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:62:37: note: in expansion of macro 'LOG_COLOR_I' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:186:86: note: in expansion of macro 'LOG_FORMAT' 186 | else { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVE' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ C:/Espressif/frameworks/esp-idf-v5.4/components/log/include/esp_log.h:114:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 114 | #define ESP_LOGI( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_INFO, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ C:/TPC/IOT/ESP32_Test/uart_events/main/uart_events_example_main.c:133:13: note: in expansion of macro 'ESP_LOGI' 133 | ESP_LOGI("CMD", "AO%d set to %.2fV for %dms",
最新发布
09-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值