活动介绍

snprintf(buffer, sizeof(buffer), "FATAL [%s:%d] " format "\n", strrchr(__FILE__, '/') + 1, __LINE__, ##__VA_ARGS__);

时间: 2024-09-10 10:27:46 浏览: 103
`snprintf` 是C语言中的一个函数,用于将格式化的数据写入字符串中。这个函数的原型定义在 `<stdio.h>` 头文件中。其作用是类似于 `printf`,但是会将输出限制在指定的字符数内,避免缓冲区溢出的风险。 在这段代码中: ```c snprintf(buffer, sizeof(buffer), "FATAL [%s:%d] " format "\n", strrchr(__FILE__, '/') + 1, __LINE__, ##__VA_ARGS__); ``` `snprintf` 函数的使用方式如下: - `buffer`:是一个字符数组(或字符指针指向的内存块),用来存放格式化后的字符串。 - `sizeof(buffer)`:表示 `buffer` 数组的大小,确保 `snprintf` 不会写入超出数组容量的数据。 - `"FATAL [%s:%d] " format "\n"`:是一个格式化字符串,其中: - `FATAL`:一个普通的字符串。 - `[%s:%d]`:两个格式占位符,`%s` 用于格式化字符串,`%d` 用于格式化整数。这里会分别被 `__FILE__` 和 `__LINE__` 替换。 - `format`:是一个可变参数宏,用于插入额外的格式化字符串。 - `"\n"`:表示输出的字符串末尾会加上换行符。 - `strrchr(__FILE__, '/') + 1`:`strrchr` 函数查找字符串 `__FILE__` 中最后一个 `/` 字符的位置,并加1,以跳过这个斜杠,得到文件名。 - `__LINE__`:是预定义的宏,表示当前代码的行号。 - `##__VA_ARGS__`:这是一个可变参数宏的用法,`##` 是连接符,允许 `format` 宏在没有额外参数时,编译器不报错。 这段代码的目的是将错误信息格式化为一个字符串,并存储在 `buffer` 中,格式通常用于记录日志或错误信息,其中包含了文件名、行号以及额外的可变参数信息。
阅读全文

相关推荐

.4.1/esp-idf/components/fatfs/src -IE:/espidf/v5.4.1/esp-idf/components/fatfs/vfs -IE:/espidf/v5.4.1/esp-idf/components/idf_test/include -IE:/espidf/v5.4.1/esp-idf/components/idf_test/include/esp32c3 -IE:/espidf/v5.4.1/esp-idf/components/ieee802154/include -IE:/espidf/v5.4.1/esp-idf/components/json/cJSON -IE:/espidf/v5.4.1/esp-idf/components/mqtt/esp-mqtt/include -IE:/espidf/v5.4.1/esp-idf/components/nvs_sec_provider/include -IE:/espidf/v5.4.1/esp-idf/components/rt/include -IE:/espidf/v5.4.1/esp-idf/components/spiffs/include -IE:/espidf/v5.4.1/esp-idf/components/wifi_provisioning/include -march=rv32imc_zicsr_zifencei -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-error=extra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -nostartfiles -Os -freorder-blocks -fmacro-prefix-map=D:/esp32_C3/internal_communication_client_0.1=. -fmacro-prefix-map=E:/espidf/v5.4.1/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/mesh_broadcast.c.obj -MF esp-idf\main\CMakeFiles\__idf_main.dir\mesh_broadcast.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/mesh_broadcast.c.obj -c D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c In file included from D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:2: D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c: In function 'handle_broadcast_message': D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:141:52: error: 'src_addr' undeclared (first use in this function) 141 | ESP_LOGI(TAG, "閰嶇疆鏇存柊鏉ヨ嚜 %s: %.*s", src_addr, len, message); | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:182:137: note: in definition of macro 'ESP_LOG_LEVEL' 182 | if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:141:13: note: in expansion of macro 'ESP_LOGI' 141 | ESP_LOGI(TAG, "閰嶇疆鏇存柊鏉ヨ嚜 %s: %.*s", src_addr, len, message); | ^~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:141:52: note: each undeclared identifier is reported only once for each function it appears in 141 | ESP_LOGI(TAG, "閰嶇疆鏇存柊鏉ヨ嚜 %s: %.*s", src_addr, len, message); | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:182:137: note: in definition of macro 'ESP_LOG_LEVEL' 182 | if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:141:13: note: in expansion of macro 'ESP_LOGI' 141 | ESP_LOGI(TAG, "閰嶇疆鏇存柊鏉ヨ嚜 %s: %.*s", src_addr, len, message); | ^~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:141:62: error: 'len' undeclared (first use in this function) 141 | ESP_LOGI(TAG, "閰嶇疆鏇存柊鏉ヨ嚜 %s: %.*s", src_addr, len, message); | ^~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:182:137: note: in definition of macro 'ESP_LOG_LEVEL' 182 | if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:141:13: note: in expansion of macro 'ESP_LOGI' 141 | ESP_LOGI(TAG, "閰嶇疆鏇存柊鏉ヨ嚜 %s: %.*s", src_addr, len, message); | ^~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:142:13: error: implicit declaration of function 'update_configuration' [-Wimplicit-function-declaration] 142 | update_configuration(message); | ^~~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:147:22: error: 'msg_type' undeclared (first use in this function) 147 | msg_type, src_addr, len, message); | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:182:137: note: in definition of macro 'ESP_LOG_LEVEL' 182 | if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW(TAG, "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 %s: %.*s", | ^~~~~~~~ ninja: build stopped: subcommand failed. * 终端进程“e:\espidf\espressif\tools\ninja\1.12.1\ninja.EXE”已终止,退出代码: 1。 * 正在执行任务: e:\espidf\espressif\tools\ninja\1.12.1\ninja.EXE [1/9] Performing build step for 'bootloader' [1/1] C:\Windows\system32\cmd.exe /C "cd /D D:\esp32_C3\internal_communication_client_0.1\build\bootloader\esp-idf\esptool_py && e:\espidf\espressif\python_env\idf5.4_py3.11_env\Scripts\python.exe E:/espidf/v5.4.1/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 D:/esp32_C3/internal_communication_client_0.1/build/bootloader/bootloader.bin" Bootloader binary size 0x5160 bytes. 0x2ea0 bytes (36%) free. [4/9] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/mesh_broadcast.c.obj FAILED: esp-idf/main/CMakeFiles/__idf_main.dir/mesh_broadcast.c.obj ccache E:\espidf\espressif\tools\riscv32-esp-elf\esp-14.2.0_20241119\riscv32-esp-elf\bin\riscv32-esp-elf-gcc.exe -DESP_PLATFORM -DIDF_VER=\"v5.4.1\" -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ -DUNITY_INCLUDE_CONFIG_H -D_GLIBCXX_HAVE_POSIX_SEMAPHORE -D_GLIBCXX_USE_POSIX_SEMAPHORE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -ID:/esp32_C3/internal_communication_client_0.1/build/config -ID:/esp32_C3/internal_communication_client_0.1/main -ID:/esp32_C3/internal_communication_client_0.1/main/include -IE:/espidf/v5.4.1/esp-idf/components/newlib/platform_include -IE:/espidf/v5.4.1/esp-idf/components/freertos/config/include -IE:/espidf/v5.4.1/esp-idf/components/freertos/config/include/freertos -IE:/espidf/v5.4.1/esp-idf/components/freertos/config/riscv/include -IE:/espidf/v5.4.1/esp-idf/components/freertos/FreeRTOS-Kernel/include -IE:/espidf/v5.4.1/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/include -IE:/espidf/v5.4.1/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos -IE:/espidf/v5.4.1/esp-idf/components/freertos/esp_additions/include -IE:/espidf/v5.4.1/esp-idf/components/esp_hw_support/include -IE:/espidf/v5.4.1/esp-idf/components/esp_hw_support/include/soc -IE:/espidf/v5.4.1/esp-idf/components/esp_hw_support/include/soc/esp32c3 -IE:/espidf/v5.4.1/esp-idf/components/esp_hw_support/dma/include -IE:/espidf/v5.4.1/esp-idf/components/esp_hw_support/ldo/include -IE:/espidf/v5.4.1/esp-idf/components/esp_hw_support/debug_probe/include -IE:/espidf/v5.4.1/esp-idf/components/esp_hw_support/port/esp32c3/. -IE:/espidf/v5.4.1/esp-idf/components/esp_hw_support/port/esp32c3/include -IE:/espidf/v5.4.1/esp-idf/components/heap/include -IE:/espidf/v5.4.1/esp-idf/components/heap/tlsf -IE:/espidf/v5.4.1/esp-idf/components/log/include -IE:/espidf/v5.4.1/esp-idf/components/soc/include -IE:/espidf/v5.4.1/esp-idf/components/soc/esp32c3 -IE:/espidf/v5.4.1/esp-idf/components/soc/esp32c3/include -IE:/espidf/v5.4.1/esp-idf/components/soc/esp32c3/register -IE:/espidf/v5.4.1/esp-idf/components/hal/platform_port/include -IE:/espidf/v5.4.1/esp-idf/components/hal/esp32c3/include -IE:/espidf/v5.4.1/esp-idf/components/hal/include -IE:/espidf/v5.4.1/esp-idf/components/esp_rom/include -IE:/espidf/v5.4.1/esp-idf/components/esp_rom/esp32c3/include -IE:/espidf/v5.4.1/esp-idf/components/esp_rom/esp32c3/include/esp32c3 -IE:/espidf/v5.4.1/esp-idf/components/esp_rom/esp32c3 -IE:/espidf/v5.4.1/esp-idf/components/esp_common/include -IE:/espidf/v5.4.1/esp-idf/components/esp_system/include -IE:/espidf/v5.4.1/esp-idf/components/esp_system/port/soc -IE:/espidf/v5.4.1/esp-idf/components/esp_system/port/include/riscv -IE:/espidf/v5.4.1/esp-idf/components/esp_system/port/include/private -IE:/espidf/v5.4.1/esp-idf/components/riscv/include -IE:/espidf/v5.4.1/esp-idf/components/lwip/include -IE:/espidf/v5.4.1/esp-idf/components/lwip/include/apps -IE:/espidf/v5.4.1/esp-idf/components/lwip/include/apps/sntp -IE:/espidf/v5.4.1/esp-idf/components/lwip/lwip/src/include -IE:/espidf/v5.4.1/esp-idf/components/lwip/port/include -IE:/espidf/v5.4.1/esp-idf/components/lwip/port/freertos/include -IE:/espidf/v5.4.1/esp-idf/components/lwip/port/esp32xx/include -IE:/espidf/v5.4.1/esp-idf/components/lwip/port/esp32xx/include/arch -IE:/espidf/v5.4.1/esp-idf/components/lwip/port/esp32xx/include/sys -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_gpio/include -IE:/espidf/v5.4.1/esp-idf/components/esp_pm/include -IE:/espidf/v5.4.1/esp-idf/components/mbedtls/port/include -IE:/espidf/v5.4.1/esp-idf/components/mbedtls/mbedtls/include -IE:/espidf/v5.4.1/esp-idf/components/mbedtls/mbedtls/library -IE:/espidf/v5.4.1/esp-idf/components/mbedtls/esp_crt_bundle/include -IE:/espidf/v5.4.1/esp-idf/components/mbedtls/mbedtls/3rdparty/everest/include -IE:/espidf/v5.4.1/esp-idf/components/mbedtls/mbedtls/3rdparty/p256-m -IE:/espidf/v5.4.1/esp-idf/components/mbedtls/mbedtls/3rdparty/p256-m/p256-m -IE:/espidf/v5.4.1/esp-idf/components/esp_app_format/include -IE:/espidf/v5.4.1/esp-idf/components/esp_bootloader_format/include -IE:/espidf/v5.4.1/esp-idf/components/app_update/include -IE:/espidf/v5.4.1/esp-idf/components/bootloader_support/include -IE:/espidf/v5.4.1/esp-idf/components/bootloader_support/bootloader_flash/include -IE:/espidf/v5.4.1/esp-idf/components/esp_partition/include -IE:/espidf/v5.4.1/esp-idf/components/efuse/include -IE:/espidf/v5.4.1/esp-idf/components/efuse/esp32c3/include -IE:/espidf/v5.4.1/esp-idf/components/esp_mm/include -IE:/espidf/v5.4.1/esp-idf/components/spi_flash/include -IE:/espidf/v5.4.1/esp-idf/components/esp_security/include -IE:/espidf/v5.4.1/esp-idf/components/pthread/include -IE:/espidf/v5.4.1/esp-idf/components/esp_timer/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_gptimer/include -IE:/espidf/v5.4.1/esp-idf/components/esp_ringbuf/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_uart/include -IE:/espidf/v5.4.1/esp-idf/components/vfs/include -IE:/espidf/v5.4.1/esp-idf/components/app_trace/include -IE:/espidf/v5.4.1/esp-idf/components/esp_event/include -IE:/espidf/v5.4.1/esp-idf/components/nvs_flash/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_pcnt/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_spi/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_mcpwm/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_ana_cmpr/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_i2s/include -IE:/espidf/v5.4.1/esp-idf/components/sdmmc/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_sdmmc/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_sdspi/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_sdio/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_dac/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_rmt/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_tsens/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_sdm/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_i2c/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_ledc/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_parlio/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_usb_serial_jtag/include -IE:/espidf/v5.4.1/esp-idf/components/driver/deprecated -IE:/espidf/v5.4.1/esp-idf/components/driver/i2c/include -IE:/espidf/v5.4.1/esp-idf/components/driver/touch_sensor/include -IE:/espidf/v5.4.1/esp-idf/components/driver/twai/include -IE:/espidf/v5.4.1/esp-idf/components/esp_phy/include -IE:/espidf/v5.4.1/esp-idf/components/esp_phy/esp32c3/include -IE:/espidf/v5.4.1/esp-idf/components/esp_vfs_console/include -IE:/espidf/v5.4.1/esp-idf/components/esp_netif/include -IE:/espidf/v5.4.1/esp-idf/components/wpa_supplicant/include -IE:/espidf/v5.4.1/esp-idf/components/wpa_supplicant/port/include -IE:/espidf/v5.4.1/esp-idf/components/wpa_supplicant/esp_supplicant/include -IE:/espidf/v5.4.1/esp-idf/components/esp_coex/include -IE:/espidf/v5.4.1/esp-idf/components/esp_wifi/include -IE:/espidf/v5.4.1/esp-idf/components/esp_wifi/include/local -IE:/espidf/v5.4.1/esp-idf/components/esp_wifi/wifi_apps/include -IE:/espidf/v5.4.1/esp-idf/components/esp_wifi/wifi_apps/nan_app/include -IE:/espidf/v5.4.1/esp-idf/components/unity/include -IE:/espidf/v5.4.1/esp-idf/components/unity/unity/src -IE:/espidf/v5.4.1/esp-idf/components/cmock/CMock/src -IE:/espidf/v5.4.1/esp-idf/components/console -IE:/espidf/v5.4.1/esp-idf/components/http_parser -IE:/espidf/v5.4.1/esp-idf/components/esp-tls -IE:/espidf/v5.4.1/esp-idf/components/esp-tls/esp-tls-crypto -IE:/espidf/v5.4.1/esp-idf/components/esp_adc/include -IE:/espidf/v5.4.1/esp-idf/components/esp_adc/interface -IE:/espidf/v5.4.1/esp-idf/components/esp_adc/esp32c3/include -IE:/espidf/v5.4.1/esp-idf/components/esp_adc/deprecated/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_isp/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_cam/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_cam/interface -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_jpeg/include -IE:/espidf/v5.4.1/esp-idf/components/esp_driver_ppa/include -IE:/espidf/v5.4.1/esp-idf/components/esp_eth/include -IE:/espidf/v5.4.1/esp-idf/components/esp_gdbstub/include -IE:/espidf/v5.4.1/esp-idf/components/esp_hid/include -IE:/espidf/v5.4.1/esp-idf/components/tcp_transport/include -IE:/espidf/v5.4.1/esp-idf/components/esp_http_client/include -IE:/espidf/v5.4.1/esp-idf/components/esp_http_server/include -IE:/espidf/v5.4.1/esp-idf/components/esp_https_ota/include -IE:/espidf/v5.4.1/esp-idf/components/esp_https_server/include -IE:/espidf/v5.4.1/esp-idf/components/esp_psram/include -IE:/espidf/v5.4.1/esp-idf/components/esp_lcd/include -IE:/espidf/v5.4.1/esp-idf/components/esp_lcd/interface -IE:/espidf/v5.4.1/esp-idf/components/protobuf-c/protobuf-c -IE:/espidf/v5.4.1/esp-idf/components/protocomm/include/common -IE:/espidf/v5.4.1/esp-idf/components/protocomm/include/security -IE:/espidf/v5.4.1/esp-idf/components/protocomm/include/transports -IE:/espidf/v5.4.1/esp-idf/components/protocomm/include/crypto/srp6a -IE:/espidf/v5.4.1/esp-idf/components/protocomm/proto-c -IE:/espidf/v5.4.1/esp-idf/components/esp_local_ctrl/include -IE:/espidf/v5.4.1/esp-idf/components/espcoredump/include -IE:/espidf/v5.4.1/esp-idf/components/espcoredump/include/port/riscv -IE:/espidf/v5.4.1/esp-idf/components/wear_levelling/include -IE:/espidf/v5.4.1/esp-idf/components/fatfs/diskio -IE:/espidf/v5.4.1/esp-idf/components/fatfs/src -IE:/espidf/v5.4.1/esp-idf/components/fatfs/vfs -IE:/espidf/v5.4.1/esp-idf/components/idf_test/include -IE:/espidf/v5.4.1/esp-idf/components/idf_test/include/esp32c3 -IE:/espidf/v5.4.1/esp-idf/components/ieee802154/include -IE:/espidf/v5.4.1/esp-idf/components/json/cJSON -IE:/espidf/v5.4.1/esp-idf/components/mqtt/esp-mqtt/include -IE:/espidf/v5.4.1/esp-idf/components/nvs_sec_provider/include -IE:/espidf/v5.4.1/esp-idf/components/rt/include -IE:/espidf/v5.4.1/esp-idf/components/spiffs/include -IE:/espidf/v5.4.1/esp-idf/components/wifi_provisioning/include -march=rv32imc_zicsr_zifencei -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-error=extra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -nostartfiles -Os -freorder-blocks -fmacro-prefix-map=D:/esp32_C3/internal_communication_client_0.1=. -fmacro-prefix-map=E:/espidf/v5.4.1/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/mesh_broadcast.c.obj -MF esp-idf\main\CMakeFiles\__idf_main.dir\mesh_broadcast.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/mesh_broadcast.c.obj -c D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c: In function 'handle_broadcast_message': D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:141:13: error: implicit declaration of function 'log_received_message' [-Wimplicit-function-declaration] 141 | log_received_message("鎺у埗鍛戒护", from, message, len); | ^~~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:141:61: error: 'len' undeclared (first use in this function) 141 | log_received_message("鎺у埗鍛戒护", from, message, len); | ^~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:141:61: note: each undeclared identifier is reported only once for each function it appears in D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:142:13: error: implicit declaration of function 'process_control_command' [-Wimplicit-function-declaration] 142 | process_control_command(message); | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:2: D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:62: error: expected ')' before 'MACSTR' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:62:88: note: in definition of macro 'LOG_FORMAT' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:182:60: note: to match this '(' 182 | if (level==ESP_LOG_ERROR ) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ In file included from E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:15: E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:98:31: error: format '%lu' expects a matching 'long unsigned int' argument [-Werror=format=] 98 | #define LOG_COLOR_E "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:98:31: error: format '%s' expects a matching 'char *' argument [-Werror=format=] 98 | #define LOG_COLOR_E "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:98:31: error: format '%d' expects a matching 'int' argument [-Werror=format=] 98 | #define LOG_COLOR_E "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:62: error: expected ')' before 'MACSTR' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:62:88: note: in definition of macro 'LOG_FORMAT' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:183:60: note: to match this '(' 183 | else if (level==ESP_LOG_WARN ) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:99:31: error: format '%lu' expects a matching 'long unsigned int' argument [-Werror=format=] 99 | #define LOG_COLOR_W "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:99:31: error: format '%s' expects a matching 'char *' argument [-Werror=format=] 99 | #define LOG_COLOR_W "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:99:31: error: format '%d' expects a matching 'int' argument [-Werror=format=] 99 | #define LOG_COLOR_W "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:62: error: expected ')' before 'MACSTR' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:62:88: note: in definition of macro 'LOG_FORMAT' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:184:60: note: to match this '(' 184 | else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:101:31: error: format '%lu' expects a matching 'long unsigned int' argument [-Werror=format=] 101 | #define LOG_COLOR_D "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:101:31: error: format '%s' expects a matching 'char *' argument [-Werror=format=] 101 | #define LOG_COLOR_D "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:101:31: error: format '%d' expects a matching 'int' argument [-Werror=format=] 101 | #define LOG_COLOR_D "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:62: error: expected ')' before 'MACSTR' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:62:88: note: in definition of macro 'LOG_FORMAT' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:185:60: note: to match this '(' 185 | else if (level==ESP_LOG_VERBOSE ) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:102:31: error: format '%lu' expects a matching 'long unsigned int' argument [-Werror=format=] 102 | #define LOG_COLOR_V "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:102:31: error: format '%s' expects a matching 'char *' argument [-Werror=format=] 102 | #define LOG_COLOR_V "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:102:31: error: format '%d' expects a matching 'int' argument [-Werror=format=] 102 | #define LOG_COLOR_V "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:62: error: expected ')' before 'MACSTR' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:62:88: note: in definition of macro 'LOG_FORMAT' 62 | #define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%" PRIu32 ") %s: " format LOG_RESET_COLOR "\n" | ^~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:186:60: note: to match this '(' 186 | else { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \ | ^ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:100:31: error: format '%lu' expects a matching 'long unsigned int' argument [-Werror=format=] 100 | #define LOG_COLOR_I "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:100:31: error: format '%s' expects a matching 'char *' argument [-Werror=format=] 100 | #define LOG_COLOR_I "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log_color.h:100:31: error: format '%d' expects a matching 'int' argument [-Werror=format=] 100 | #define LOG_COLOR_I "" | ^~ E:/espidf/v5.4.1/esp-idf/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" | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/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__); } \ | ^~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:205:38: note: in expansion of macro 'ESP_LOG_LEVEL' 205 | if (_ESP_LOG_ENABLED(level)) ESP_LOG_LEVEL(level, tag, format, ##__VA_ARGS__); \ | ^~~~~~~~~~~~~ E:/espidf/v5.4.1/esp-idf/components/log/include/esp_log.h:113:38: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL' 113 | #define ESP_LOGW( tag, format, ... ) ESP_LOG_LEVEL_LOCAL(ESP_LOG_WARN, tag, format, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~~ D:/esp32_C3/internal_communication_client_0.1/main/mesh_broadcast.c:146:13: note: in expansion of macro 'ESP_LOGW' 146 | ESP_LOGW("BROADCAST_RX", "鏈煡骞挎挱绫诲瀷 %d 鏉ヨ嚜 " MACSTR, | ^~~~~~~~ cc1.exe: some warnings being treated as errors ninja: build stopped: subcommand failed. * 终端进程“e:\espidf\espressif\tools\ninja\1.12.1\ninja.EXE”已终止,退出代码: 1。

FRESULT res; FATFS fs; char dir_path[] = "0:/sample"; // 目标目录 char filename[64]; // 需要创建新文件时 FRESULT mount_res = f_mount(0, &fs); if (data_file_info.count == 0) { // 关闭之前打开的文件 if (data_file_info.file.fs) { f_close(&data_file_info.file); } //确保目标目录存在 FILINFO fno; res = f_stat(dir_path, &fno); if (res == FR_NO_FILE) { // 目录不存在 res = f_mkdir(dir_path); // 创建目录 if (res != FR_OK) { printf("目录创建失败 %s: %d\n", dir_path, res); return; } } else if (res != FR_OK) { printf("目录访问错误: %d\n", res); return; } // 生成带路径的文件名 snprintf(filename, sizeof(filename), "%s/sampleData%04d%02d%02d%02d%02d%02d.txt", dir_path, year, month, day, hour, minute, second); // 创建新文件 res = f_open(&data_file_info.file, filename, FA_CREATE_ALWAYS | FA_WRITE); if (res != FR_OK) { printf("文件创建失败 %s: %d\n", filename, res); return; } } // 写入数据 char data_line[50]; snprintf(data_line, sizeof(data_line), "20%02d-%02d-%02d %02d:%02d:%02d %.2f V\n", year, month, day, hour, minute, second, vol_value); UINT bw; res = f_write(&data_file_info.file, data_line, strlen(data_line), &bw); if (res != FR_OK || bw != strlen(data_line)) { printf("数据写入失败: %d\n", res); } else { f_sync(&data_file_info.file); data_file_info.count++; f_mount(0, NULL);//卸载文件系统 // 达到10条数据后重置 if (data_file_info.count >= 10) { data_file_info.count = 0; } } last_sample_time = current_tick; } 运行后数据写入失败: 9

void write_data_to_file(const char* dir_path, int year, int month, int day, int hour, int minute, int second, float vol_value) { FRESULT res; FATFS fs; char filename[64]; // 检查是否需要初始化文件系统 if (data_file_info.count == 0) { // 初始化存储设备 DSTATUS status = disk_initialize(0); if (status != 0) { printf("磁盘初始化失败. 状态: 0x%02X\n", status); return; } // 挂载文件系统 (保持原始调用方式) res = f_mount(0, &fs); // 注意:第一个参数是0表示物理驱动器号 if (res != FR_OK) { printf("挂载失败=%d\n", res); return; } // 确保目录存在 FILINFO fno; res = f_stat(dir_path, &fno); if (res == FR_NO_FILE) { res = f_mkdir(dir_path); if (res != FR_OK) { printf("目录创建失败 %s: %d\n", dir_path, res); return; } } else if (res != FR_OK) { printf("目录访问错误: %d\n", res); return; } // 生成文件名 snprintf(filename, sizeof(filename), "%s/sampleDeta20%02d%02d%02d%02d%02d%02d.txt", dir_path, year, month, day, hour, minute, second); // 创建新文件 res = f_open(&data_file_info.file, filename, FA_CREATE_ALWAYS | FA_WRITE); if (res != FR_OK) { printf("文件创建失败 %s: %d\n", filename, res); return; } else { printf("文件创建成功: %s\n", filename); // 打印实际文件名 } } // 写入数据 char data_line[50]; snprintf(data_line, sizeof(data_line), "20%02d-%02d-%02d %02d:%02d:%02d %.2f V\r\n", year, month, day, hour, minute, second, vol_value); UINT bw; res = f_write(&data_file_info.file, data_line, strlen(data_line), &bw); if (res != FR_OK || bw != strlen(data_line)) { printf("数据写入失败: %d\n", res); } else { f_sync(&data_file_info.file); // 确保数据写入物理设备 data_file_info.count++; // 每10条数据关闭文件并卸载文件系统 if (data_file_info.count >= 10) { // 关键修复:显式关闭文件 f_close(&data_file_info.file); // 保持原始卸载方式 f_mount(0, NULL); // 卸载文件系统 // 重置计数器 data_file_info.count = 0; // 清除文件系统引用 memset(&data_file_info.file, 0, sizeof(FIL)); } } }

if (strcmp(dir_path, "0:/overLimit") == 0) { char filename[64]; if (data_file_info.count == 0) { //初始化存储设备 DSTATUS status = disk_initialize(0); if (status != 0) { printf("Disk initialize failed. Status: 0x%02X\n", status); return; } //挂载文件系统 res = f_mount(0, &fs); if (res != FR_OK) { printf("Mount failed=%d\n", res); return; } // 关闭之前打开的文件 if (data_file_info.file.fs) { f_close(&data_file_info.file); } //确保目标目录存在 FILINFO fno; res = f_stat(dir_path, &fno); if (res == FR_NO_FILE) { // 目录不存在 res = f_mkdir(dir_path); // 创建目录 if (res != FR_OK) { printf("目录创建失败 %s: %d\n", dir_path, res); return; } } else if (res != FR_OK) { printf("目录访问错误: %d\n", res); return; } // 生成带路径的文件名 snprintf(filename, sizeof(filename), "%s/overLimit20%02d%02d%02d%02d%02d%02d.txt", dir_path, year, month, day, hour, minute, second); // 创建新文件 res = f_open(&data_file_info.file, filename, FA_CREATE_ALWAYS | FA_WRITE); if (res != FR_OK) { printf("文件创建失败 %s: %d\n", filename, res); // return; }else{ printf("文件创建成功"); f_open(&data_file_info.file, filename, FA_CREATE_ALWAYS | FA_WRITE); } } current_limit = read_current_limit(); // 写入数据 char data_line[50]; snprintf(data_line, sizeof(data_line), "20%02d-%02d-%02d %02d:%02d:%02d %.2f V limit %.2f V\r\n", year, month, day, hour, minute, second, vol_value , current_limit); UINT bw; // f_open(&data_file_info.file, filename, FA_CREATE_ALWAYS | FA_WRITE); res = f_write(&data_file_info.file, data_line, strlen(data_line), &bw); // f_close(&data_file_info.file); // f_mount(0, NULL);//卸载文件系统 if (res != FR_OK || bw != strlen(data_line)) { printf("数据写入失败: %d\n", res); } else { f_sync(&data_file_info.file); data_file_info.count++; // 达到10条数据后重置 if (data_file_info.count >= 10) { data_file_info.count = 0; f_mount(0, NULL);//卸载文件系统 } } }当数据写入5条时,此时串口发送数据使dir_path不是sample,怎么推出,且不应下下一次从第一个文件创建到第十个文件,而不是接着存进上一次的5个数据的txt文件

#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <dirent.h> #include <sys/stat.h> #include <time.h> #include <fcntl.h> #include <curl/curl.h> #define VERSION "1.1-deepin" // 修正:中文引号改为英文引号 #define KNOWLEDGE_DIR "./xiaoxing/knowledge" #define EVOLUTION_DIR "./xiaoxing/evolution" #define BACKUP_DIR "./xiaoxing/backup" #define USER_AGENT "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" // 回调函数:保存curl获取的数据到文件 size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) { return fwrite(ptr, size, nmemb, stream); } // 百度百科知识获取 void fetch_baike(const char *keyword) { printf("【小星】从百度百科获取: %s\n", keyword); // 修正:中文引号改为英文引号 char url[512]; snprintf(url, sizeof(url), "https://baike.baidu.com/item/%s", keyword); CURL *curl = curl_easy_init(); FILE *fp = fopen("/tmp/baike.tmp", "w"); if (curl && fp) { curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); CURLcode res = curl_easy_perform(curl); if (res != CURLE_OK) { printf("获取失败: %s\n", curl_easy_strerror(res)); } else { char knowledge_file[256]; snprintf(knowledge_file, sizeof(knowledge_file), "%s/%s.know", KNOWLEDGE_DIR, keyword); if (rename("/tmp/baike.tmp", knowledge_file) == 0) { printf("-> 已保存到知识库: %s\n", knowledge_file); } } fclose(fp); } curl_easy_cleanup(curl); } // 知乎知识获取 void fetch_zhihu(const char *topic) { printf("【小星】从知乎获取: %s\n", topic); // 修正:中文引号改为英文引号 char url[512]; snprintf(url, sizeof(url), "https://www.zhihu.com/api/v4/search/top_search?keyword=%s", topic); CURL *curl = curl_easy_init(); FILE *fp = fopen("/tmp/zhihu.tmp", "w"); if (curl && fp) { struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Authorization: oauth c3cef7c66a182987aa2dd510560a914d"); headers = curl_slist_append(headers, "User-Agent: " USER_AGENT); curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); CURLcode res = curl_easy_perform(curl); if (res != CURLE_OK) { printf("获取失败: %s\n", curl_easy_strerror(res)); } else { char knowledge_file[256]; snprintf(knowledge_file, sizeof(knowledge_file), "%s/%s.know", KNOWLEDGE_DIR, topic); if (rename("/tmp/zhihu.tmp", knowledge_file) == 0) { printf("-> 已保存到知识库: %s\n", knowledge_file); } } curl_slist_free_all(headers); fclose(fp); } curl_easy_cleanup(curl); } // 初始化文件系统 void init_filesystem() { char *dirs[] = {KNOWLEDGE_DIR, EVOLUTION_DIR, BACKUP_DIR}; for (int i = 0; i < 3; i++) { char cmd[256]; snprintf(cmd, sizeof(cmd), "mkdir -p %s", dirs[i]); // 修正:中文引号改为英文引号 if (system(cmd) != 0) { printf("警告:创建目录 %s 失败\n", dirs[i]); // 修正:中文引号改为英文引号 } } const char *init_keywords[] = {"人工智能", "深度学习", "Linux内核"}; for (int i = 0; i < sizeof(init_keywords)/sizeof(init_keywords[0]); i++) { char path[256]; snprintf(path, sizeof(path), "%s/%s.know", KNOWLEDGE_DIR, init_keywords[i]); if (access(path, F_OK) != 0) { FILE *fp = fopen(path, "w"); if (fp) { fprintf(fp, "初始知识: %s\n", init_keywords[i]); fclose(fp); } } } } // 本地知识处理 void process_local_knowledge() { printf("【小星】扫描本地知识库...\n"); // 修正:中文引号改为英文引号 DIR *dir = opendir(KNOWLEDGE_DIR); if (!dir) { printf("无法打开知识库: %s\n", KNOWLEDGE_DIR); // 修正:中文引号改为英文引号 return; } struct dirent *entry; while ((entry = readdir(dir)) != NULL) { if (entry->d_name[0] == '.') continue; if (strstr(entry->d_name, ".know") == NULL) continue; char path[512]; snprintf(path, sizeof(path), "%s/%s", KNOWLEDGE_DIR, entry->d_name); FILE *fp = fopen(path, "r"); if (fp) { char preview[31] = {0}; fread(preview, 1, 30, fp); printf("-> 学习: %s (预览: %s...)\n", entry->d_name, preview); // 修正:中文引号改为英文引号 fclose(fp); } } closedir(dir); } // 生成新知识 void generate_knowledge() { printf("【小星】创建新知识...\n"); // 修正:中文引号改为英文引号 const char *domains[] = {"人工智能", "操作系统", "编程语言"}; const char *contents[] = { "基础概念:%s是一种...\n", "应用场景:%s可用于...\n", "发展历史:%s起源于...\n" }; time_t now = time(NULL); struct tm *tm = localtime(&now); char new_know_path[256]; snprintf(new_know_path, sizeof(new_know_path), "%s/%04d%02d%02d-%03d.know", KNOWLEDGE_DIR, tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, rand() % 1000); FILE *fp = fopen(new_know_path, "w"); if (fp) { const char *domain = domains[rand() % (sizeof(domains)/sizeof(domains[0]))]; const char *content = contents[rand() % (sizeof(contents)/sizeof(contents[0]))]; fprintf(fp, "主题: %s\n", domain); fprintf(fp, content, domain); fprintf(fp, "生成时间: %04d-%02d-%02d %02d:%02d:%02d\n", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); fclose(fp); printf("-> 已创建新知识: %s\n", new_know_path); } } // 系统优化 void optimize_deepin() { printf("【小星】优化Deepin系统...\n"); // 修正:中文引号改为英文引号 printf("-> 清理系统缓存...\n"); // 修正:中文引号改为英文引号 system("rm -rf ~/.cache/* 2>/dev/null"); printf("-> 优化应用启动速度...\n"); // 修正:中文引号改为英文引号 system("update-desktop-database ~/.local/share/applications 2>/dev/null"); printf("-> 系统优化完成(安全模式)\n"); // 修正:中文引号改为英文引号 } // 系统状态查看 void show_system_status() { printf("\n===== 系统状态 =====\n"); // 修正:中文引号改为英文引号 printf("1. 知识库信息\n"); // 修正:中文引号改为英文引号 printf(" - 位置: %s\n", KNOWLEDGE_DIR); // 修正:中文引号改为英文引号 char cmd[512]; snprintf(cmd, sizeof(cmd), "ls %s/*.know 2>/dev/null | wc -l", KNOWLEDGE_DIR); printf(" - 知识数量: "); // 修正:中文引号改为英文引号 system(cmd); snprintf(cmd, sizeof(cmd), "du -sh %s 2>/dev/null", KNOWLEDGE_DIR); printf(" - 占用空间: "); // 修正:中文引号改为英文引号 system(cmd); time_t now = time(NULL); printf("2. 系统时间: %s", ctime(&now)); // 修正:中文引号改为英文引号 } // 主菜单交互 void main_menu() { printf("\n===== 小星系统 %s (Deepin版) =====\n", VERSION); // 修正:中文引号改为英文引号 printf("1. 从百度百科学习\n"); // 修正:中文引号改为英文引号 printf("2. 从知乎学习\n"); // 修正:中文引号改为英文引号 printf("3. 离线学习(本地知识)\n"); // 修正:中文引号改为英文引号 printf("4. 优化系统(安全模式)\n"); // 修正:中文引号改为英文引号 printf("5. 查看系统状态\n"); // 修正:中文引号改为英文引号 printf("6. 退出\n"); // 修正:中文引号改为英文引号 printf("请选择操作 [1-6]: "); // 修正:中文引号改为英文引号 } int main() { srand(time(NULL)); init_filesystem(); printf("===== 小星系统启动 (Deepin版) =====\n"); // 修正:中文引号改为英文引号 printf("提示:使用前请确保已安装 curl (sudo apt install curl)\n"); // 修正:中文引号改为英文引号 int running = 1; while (running) { main_menu(); int choice; if (scanf("%d", &choice) != 1) { printf("输入错误,请输入数字\n"); // 修正:中文引号改为英文引号 while (getchar() != '\n'); continue; } char keyword[128] = {0}; switch (choice) { case 1: printf("请输入百度百科关键词: "); // 修正:中文引号改为英文引号 scanf("%s", keyword); fetch_baike(keyword); break; case 2: printf("请输入知乎话题: "); // 修正:中文引号改为英文引号 scanf("%s", keyword); fetch_zhihu(keyword); break; case 3: process_local_knowledge(); generate_knowledge(); break; case 4: optimize_deepin(); break; case 5: show_system_status(); break; case 6: running = 0; break; default: printf("无效选择,请输入1-6\n"); // 修正:中文引号改为英文引号 } } printf("小星系统已关闭,再见!\n"); // 修正:中文引号改为英文引号 return 0; }

/** * Copyright (C) 2008 Happy Fish / YuQing * * FastDFS may be copied only under the terms of the GNU General * Public License V3, which may be found in the FastDFS source kit. * Please visit the FastDFS Home Page http://www.fastken.com/ for more detail. **/ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include #include <time.h> #include <unistd.h> #include "fastcommon/logger.h" #include "fastcommon/shared_func.h" #include "fastcommon/sockopt.h" #include "fastcommon/http_func.h" #include "fastcommon/local_ip_func.h" #include "fastdfs/fdfs_define.h" #include "fastdfs/fdfs_global.h" #include "fastdfs/fdfs_http_shared.h" #include "fastdfs/fdfs_client.h" #include "fastdfs/fdfs_shared_func.h" #include "fastdfs/trunk_shared.h" #include "common.h" #define FDFS_MOD_REPONSE_MODE_PROXY 'P' #define FDFS_MOD_REPONSE_MODE_REDIRECT 'R' #define FDFS_CONTENT_TYPE_TAG_STR "Content-type: " #define FDFS_CONTENT_TYPE_TAG_LEN (sizeof(FDFS_CONTENT_TYPE_TAG_STR) - 1) #define FDFS_CONTENT_RANGE_TAG_STR "Content-range: " #define FDFS_CONTENT_RANGE_TAG_LEN (sizeof(FDFS_CONTENT_RANGE_TAG_STR) - 1) static char flv_header[] = "FLV\x1\x1\0\0\0\x9\0\0\0\x9"; #define FDFS_RANGE_LENGTH(range) ((range.end - range.start) + 1) typedef struct tagGroupStorePaths { char group_name[FDFS_GROUP_NAME_MAX_LEN + 1]; int group_name_len; int storage_server_port; FDFSStorePaths store_paths; } GroupStorePaths; static int storage_server_port = FDFS_STORAGE_SERVER_DEF_PORT; static int my_group_name_len = 0; static int group_count = 0; //for multi groups static bool url_have_group_name = false; static bool use_storage_id = false; static bool flv_support = false; //if support flv static char flv_extension[FDFS_FILE_EXT_NAME_MAX_LEN + 1] = {0}; //flv extension name static int flv_ext_len = 0; //flv extension length static char my_group_name[FDFS_GROUP_NAME_MAX_LEN + 1] = {0}; static char response_mode = FDFS_MOD_REPONSE_MODE_PROXY; static GroupStorePaths *group_store_paths = NULL; //for multi groups static FDFSHTTPParams g_http_params; static int storage_sync_file_max_delay = 24 * 3600; static int fdfs_get_params_from_tracker(); static int fdfs_format_http_datetime(time_t t, char *buff, const int buff_size); static int fdfs_strtoll(const char *s, int64_t *value) { char *end = NULL; *value = strtoll(s, &end, 10); if (end != NULL && *end != '\0') { return EINVAL; } return 0; } static int fdfs_load_groups_store_paths(IniContext *pItemContext) { char section_name[64]; char *pGroupName; int bytes; int result; int i; bytes = sizeof(GroupStorePaths) * group_count; group_store_paths = (GroupStorePaths *)malloc(bytes); if (group_store_paths == NULL) { logError("file: "__FILE__", line: %d, " \ "malloc %d bytes fail, " \ "errno: %d, error info: %s", \ __LINE__, bytes, errno, STRERROR(errno)); return errno != 0 ? errno : ENOMEM; } for (i=0; i<group_count; i++) { sprintf(section_name, "group%d", i + 1); pGroupName = iniGetStrValue(section_name, "group_name", \ pItemContext); if (pGroupName == NULL) { logError("file: "__FILE__", line: %d, " \ "section: %s, you must set parameter: " \ "group_name!", __LINE__, section_name); return ENOENT; } group_store_paths[i].storage_server_port = iniGetIntValue( \ section_name, "storage_server_port", pItemContext, \ FDFS_STORAGE_SERVER_DEF_PORT); group_store_paths[i].group_name_len = snprintf( \ group_store_paths[i].group_name, \ sizeof(group_store_paths[i].group_name), \ "%s", pGroupName); if (group_store_paths[i].group_name_len == 0) { logError("file: "__FILE__", line: %d, " \ "section: %s, parameter: group_name " \ "can't be empty!", __LINE__, section_name); return EINVAL; } group_store_paths[i].store_paths.paths = \ storage_load_paths_from_conf_file_ex(pItemContext, \ section_name, false, &group_store_paths[i].store_paths.count, \ &result); if (result != 0) { return result; } } return 0; } int fdfs_mod_init() { IniContext iniContext; int result; int len; int i; char *pLogFilename; char *pReponseMode; char *pIfAliasPrefix; char buff[2 * 1024]; bool load_fdfs_parameters_from_tracker = false; log_init(); trunk_shared_init(); if ((result=iniLoadFromFile(FDFS_MOD_CONF_FILENAME, &iniContext)) != 0) { logError("file: "__FILE__", line: %d, " \ "load conf file \"%s\" fail, ret code: %d", \ __LINE__, FDFS_MOD_CONF_FILENAME, result); return result; } do { group_count = iniGetIntValue(NULL, "group_count", &iniContext, 0); if (group_count < 0) { logError("file: "__FILE__", line: %d, " \ "conf file: %s, group_count: %d is invalid!", \ __LINE__, FDFS_MOD_CONF_FILENAME, group_count); return EINVAL; } url_have_group_name = iniGetBoolValue(NULL, "url_have_group_name", \ &iniContext, false); if (group_count > 0) { if (!url_have_group_name) { logError("file: "__FILE__", line: %d, " \ "config file: %s, you must set " \ "url_have_group_name to true to " \ "support multi-group!", \ __LINE__, FDFS_MOD_CONF_FILENAME); result = ENOENT; break; } if ((result=fdfs_load_groups_store_paths(&iniContext)) != 0) { break; } } else { char *pGroupName; pGroupName = iniGetStrValue(NULL, "group_name", &iniContext); if (pGroupName == NULL) { logError("file: "__FILE__", line: %d, " \ "config file: %s, you must set parameter: " \ "group_name!", __LINE__, FDFS_MOD_CONF_FILENAME); result = ENOENT; break; } my_group_name_len = snprintf(my_group_name, \ sizeof(my_group_name), "%s", pGroupName); if (my_group_name_len == 0) { logError("file: "__FILE__", line: %d, " \ "config file: %s, parameter: group_name " \ "can't be empty!", __LINE__, \ FDFS_MOD_CONF_FILENAME); result = EINVAL; break; } if ((result=storage_load_paths_from_conf_file(&iniContext)) != 0) { break; } } FDFS_CONNECT_TIMEOUT = iniGetIntValue(NULL, "connect_timeout", \ &iniContext, DEFAULT_CONNECT_TIMEOUT); if (FDFS_CONNECT_TIMEOUT <= 0) { FDFS_CONNECT_TIMEOUT = DEFAULT_CONNECT_TIMEOUT; } FDFS_NETWORK_TIMEOUT = iniGetIntValue(NULL, "network_timeout", \ &iniContext, DEFAULT_NETWORK_TIMEOUT); if (FDFS_NETWORK_TIMEOUT <= 0) { FDFS_NETWORK_TIMEOUT = DEFAULT_NETWORK_TIMEOUT; } load_log_level(&iniContext); pLogFilename = iniGetStrValue(NULL, "log_filename", &iniContext); if (pLogFilename != NULL && *pLogFilename != '\0') { if ((result=log_set_filename(pLogFilename)) != 0) { break; } } storage_server_port = iniGetIntValue(NULL, "storage_server_port", \ &iniContext, FDFS_STORAGE_SERVER_DEF_PORT); if ((result=fdfs_http_params_load(&iniContext, FDFS_MOD_CONF_FILENAME, \ &g_http_params)) != 0) { break; } pReponseMode = iniGetStrValue(NULL, "response_mode", &iniContext); if (pReponseMode != NULL) { if (strcmp(pReponseMode, "redirect") == 0) { response_mode = FDFS_MOD_REPONSE_MODE_REDIRECT; } } pIfAliasPrefix = iniGetStrValue (NULL, "if_alias_prefix", &iniContext); if (pIfAliasPrefix == NULL) { *g_if_alias_prefix = '\0'; } else { snprintf(g_if_alias_prefix, sizeof(g_if_alias_prefix), "%s", pIfAliasPrefix); } load_fdfs_parameters_from_tracker = iniGetBoolValue(NULL, \ "load_fdfs_parameters_from_tracker", \ &iniContext, false); if (load_fdfs_parameters_from_tracker) { result = fdfs_load_tracker_group_ex(&g_tracker_group, \ FDFS_MOD_CONF_FILENAME, &iniContext); } else { storage_sync_file_max_delay = iniGetIntValue(NULL, \ "storage_sync_file_max_delay", \ &iniContext, 24 * 3600); use_storage_id = iniGetBoolValue(NULL, "use_storage_id", \ &iniContext, false); if (use_storage_id) { result = fdfs_load_storage_ids_from_file( \ FDFS_MOD_CONF_FILENAME, &iniContext); } } } while (false); flv_support = iniGetBoolValue(NULL, "flv_support", \ &iniContext, false); if (flv_support) { char *flvExtension; flvExtension = iniGetStrValue (NULL, "flv_extension", \ &iniContext); if (flvExtension == NULL) { flv_ext_len = sprintf(flv_extension, "flv"); } else { flv_ext_len = snprintf(flv_extension, \ sizeof(flv_extension), "%s", flvExtension); } } iniFreeContext(&iniContext); if (result != 0) { return result; } load_local_host_ip_addrs(); if (load_fdfs_parameters_from_tracker) { fdfs_get_params_from_tracker(); } if (group_count > 0) { len = sprintf(buff, "group_count=%d, ", group_count); } else { len = sprintf(buff, "group_name=%s, storage_server_port=%d, " \ "path_count=%d, ", my_group_name, \ storage_server_port, g_fdfs_store_paths.count); for (i=0; i<g_fdfs_store_paths.count; i++) { len += snprintf(buff + len, sizeof(buff) - len, \ "store_path%d=%s, ", i, \ g_fdfs_store_paths.paths[i].path); } } logInfo("fastdfs apache / nginx module v1.21, " "response_mode=%s, " "base_path=%s, " "url_have_group_name=%d, " "%s" "connect_timeout=%d, " "network_timeout=%d, " "tracker_server_count=%d, " "if_alias_prefix=%s, " "local_host_ip_count=%d, " "anti_steal_token=%d, " "token_ttl=%ds, " "anti_steal_secret_key length=%d, " "token_check_fail content_type=%s, " "token_check_fail buff length=%d, " "load_fdfs_parameters_from_tracker=%d, " "storage_sync_file_max_delay=%ds, " "use_storage_id=%d, storage server id/ip count=%d / %d, " "flv_support=%d, flv_extension=%s", response_mode == FDFS_MOD_REPONSE_MODE_PROXY ? "proxy" : "redirect", FDFS_BASE_PATH_STR, url_have_group_name, buff, FDFS_CONNECT_TIMEOUT, FDFS_NETWORK_TIMEOUT, g_tracker_group.server_count, g_if_alias_prefix, g_local_host_ip_count, g_http_params.anti_steal_token, g_http_params.token_ttl, g_http_params.anti_steal_secret_key.length, g_http_params.token_check_fail_content_type, g_http_params.token_check_fail_buff.length, load_fdfs_parameters_from_tracker, storage_sync_file_max_delay, use_storage_id, g_storage_ids_by_id.count, g_storage_ids_by_ip.count, flv_support, flv_extension); if (group_count > 0) { int k; for (k=0; k<group_count; k++) { len = 0; *buff = '\0'; for (i=0; i<group_store_paths[k].store_paths.count; i++) { len += snprintf(buff + len, sizeof(buff) - len, \ ", store_path%d=%s", i, \ group_store_paths[k].store_paths.paths[i].path); } logInfo("group %d. group_name=%s, " \ "storage_server_port=%d, path_count=%d%s", \ k + 1, group_store_paths[k].group_name, \ storage_server_port, group_store_paths[k]. \ store_paths.count, buff); } } //print_local_host_ip_addrs(); return 0; } #define OUTPUT_HEADERS(pContext, pResponse, http_status) \ do { \ (pResponse)->status = http_status; \ pContext->output_headers(pContext->arg, pResponse); \ } while (0) static int fdfs_send_boundary(struct fdfs_http_context *pContext, struct fdfs_http_response *pResponse, const bool bLast) { int result; if ((result=pContext->send_reply_chunk(pContext->arg, false, "\r\n--", 4)) != 0) { return result; } if ((result=pContext->send_reply_chunk(pContext->arg, false, pResponse->boundary, pResponse->boundary_len)) != 0) { return result; } if (bLast) { result = pContext->send_reply_chunk(pContext->arg, true, "--\r\n", 4); } else { result = pContext->send_reply_chunk(pContext->arg, false, "\r\n", 2); } return result; } static int fdfs_send_range_subheader(struct fdfs_http_context *pContext, struct fdfs_http_response *pResponse, const int index) { char buff[256]; int len; len = snprintf(buff, sizeof(buff), "%s%s\r\n%s%s\r\n\r\n", FDFS_CONTENT_TYPE_TAG_STR, pResponse->range_content_type, FDFS_CONTENT_RANGE_TAG_STR, pResponse->content_ranges[index].content); return pContext->send_reply_chunk(pContext->arg, false, buff, len); } static int fdfs_download_callback(void *arg, const int64_t file_size, \ const char *data, const int current_size) { struct fdfs_download_callback_args *pCallbackArgs; int result; bool bLast; pCallbackArgs = (struct fdfs_download_callback_args *)arg; if (!pCallbackArgs->pResponse->header_outputed) { if (!(pCallbackArgs->pContext->if_range && pCallbackArgs->pContext->range_count > 1)) { pCallbackArgs->pResponse->content_length = file_size; } OUTPUT_HEADERS(pCallbackArgs->pContext, pCallbackArgs->pResponse, HTTP_OK); } if (pCallbackArgs->pContext->if_range && pCallbackArgs-> pContext->range_count > 1) { bLast = false; if (pCallbackArgs->sent_bytes == 0) { if ((result=fdfs_send_boundary(pCallbackArgs->pContext, pCallbackArgs->pResponse, false)) != 0) { return result; } if ((result=fdfs_send_range_subheader(pCallbackArgs->pContext, pCallbackArgs->pResponse, pCallbackArgs->range_index)) != 0) { return result; } } } else { bLast = true; } pCallbackArgs->sent_bytes += current_size; return pCallbackArgs->pContext->send_reply_chunk( pCallbackArgs->pContext->arg, (pCallbackArgs->sent_bytes == file_size && bLast) ? 1 : 0, data, current_size); } static void fdfs_do_format_range(const struct fdfs_http_range *range, struct fdfs_http_response *pResponse) { if (range->start < 0) { pResponse->range_len += sprintf(pResponse->range + pResponse->range_len, \ "%"PRId64, range->start); } else if (range->end == 0) { pResponse->range_len += sprintf(pResponse->range + pResponse->range_len, \ "%"PRId64"-", range->start); } else { pResponse->range_len += sprintf(pResponse->range + pResponse->range_len, \ "%"PRId64"-%"PRId64, \ range->start, range->end); } } static void fdfs_format_range(struct fdfs_http_context *pContext, struct fdfs_http_response *pResponse) { int i; pResponse->range_len = sprintf(pResponse->range, "%s", "bytes="); for (i=0; irange_count; i++) { if (i > 0) { *(pResponse->range + pResponse->range_len) = ','; pResponse->range_len++; } fdfs_do_format_range(pContext->ranges + i, pResponse); } } static void fdfs_do_format_content_range(const struct fdfs_http_range *range, const int64_t file_size, struct fdfs_http_resp_content_range *content_range) { content_range->length = sprintf(content_range->content, "bytes %"PRId64"-%"PRId64"/%"PRId64, range->start, range->end, file_size); } static void fdfs_format_content_range(struct fdfs_http_context *pContext, const int64_t file_size, struct fdfs_http_response *pResponse) { int i; pResponse->content_range_count = pContext->range_count; for (i=0; irange_count; i++) { fdfs_do_format_content_range(pContext->ranges + i, file_size, pResponse->content_ranges + i); } } static int64_t fdfs_calc_download_bytes(struct fdfs_http_context *pContext) { int64_t download_bytes; int i; download_bytes = 0; for (i=0; irange_count; i++) { download_bytes += FDFS_RANGE_LENGTH(pContext->ranges[i]); } return download_bytes; } static int fdfs_calc_content_length(struct fdfs_http_context *pContext, const int64_t download_bytes, const int flv_header_len, const char *ext_name, const int ext_len, struct fdfs_http_response *pResponse) { int result; int i; int content_type_part_len; int boundary_part_len; pResponse->content_length = download_bytes + flv_header_len; if (pContext->if_range && pContext->range_count > 1) { pResponse->boundary_len = sprintf(pResponse->boundary, "%"PRIx64, get_current_time_us()); sprintf(pResponse->content_type_buff, "multipart/byteranges; boundary=%s", pResponse->boundary); pResponse->content_type = pResponse->content_type_buff; if ((result=fdfs_http_get_content_type_by_extname(&g_http_params, ext_name, ext_len, pResponse->range_content_type, sizeof(pResponse->range_content_type))) != 0) { return result; } content_type_part_len = FDFS_CONTENT_TYPE_TAG_LEN + strlen(pResponse->range_content_type) + 2; boundary_part_len = 4 + pResponse->boundary_len + 2; pResponse->content_length += (pContext->range_count + 1) * boundary_part_len; pResponse->content_length += pContext->range_count * content_type_part_len; for (i=0; irange_count; i++) { pResponse->content_length += FDFS_CONTENT_RANGE_TAG_LEN + pResponse->content_ranges[i].length + 4; } pResponse->content_length += 2; //last -- } return 0; } static int fdfs_do_check_and_format_range(struct fdfs_http_range *range, const int64_t file_size) { if (range->start < 0) { int64_t start; start = range->start + file_size; if (start < 0) { logWarning("file: "__FILE__", line: %d, " \ "invalid range value: %"PRId64", set to 0", \ __LINE__, range->start); start = 0; } range->start = start; } else if (range->start >= file_size) { logError("file: "__FILE__", line: %d, " \ "invalid range start value: %"PRId64 \ ", exceeds file size: %"PRId64, \ __LINE__, range->start, file_size); return EINVAL; } if (range->end == 0) { range->end = file_size - 1; } else if (range->end >= file_size) { logWarning("file: "__FILE__", line: %d, " \ "invalid range end value: %"PRId64 \ ", exceeds file size: %"PRId64, \ __LINE__, range->end, file_size); range->end = file_size - 1; } if (range->start > range->end) { logError("file: "__FILE__", line: %d, " \ "invalid range value, start: %"PRId64 \ ", exceeds end: %"PRId64, \ __LINE__, range->start, range->end); return EINVAL; } return 0; } static int fdfs_check_and_format_range(struct fdfs_http_context *pContext, const int64_t file_size) { int result; int i; result = 0; for (i=0; irange_count; i++) { if ((result=fdfs_do_check_and_format_range(pContext->ranges + i, file_size)) != 0) { return result; } } return 0; } #define FDFS_SET_LAST_MODIFIED(response, pContext, mtime) \ do { \ response.last_modified = mtime; \ fdfs_format_http_datetime(response.last_modified, \ response.last_modified_buff, \ sizeof(response.last_modified_buff)); \ if (*pContext->if_modified_since != '\0') \ { \ if (strcmp(response.last_modified_buff, \ pContext->if_modified_since) == 0) \ { \ OUTPUT_HEADERS(pContext, (&response), HTTP_NOTMODIFIED);\ return HTTP_NOTMODIFIED; \ } \ } \ \ /*\ logInfo("last_modified: %s, if_modified_since: %s, strcmp=%d", \ response.last_modified_buff, \ pContext->if_modified_since, \ strcmp(response.last_modified_buff, \ pContext->if_modified_since)); \ */ \ } while (0) static int fdfs_send_file_buffer(struct fdfs_http_context *pContext, const char *full_filename, int fd, const int64_t download_bytes, const bool bLast) { char file_trunk_buff[FDFS_OUTPUT_CHUNK_SIZE]; off_t remain_bytes; int read_bytes; int result; remain_bytes = download_bytes; while (remain_bytes > 0) { read_bytes = remain_bytes <= FDFS_OUTPUT_CHUNK_SIZE ? \ remain_bytes : FDFS_OUTPUT_CHUNK_SIZE; if (read(fd, file_trunk_buff, read_bytes) != read_bytes) { result = errno != 0 ? errno : EIO; logError("file: "__FILE__", line: %d, " \ "read from file %s fail, " \ "errno: %d, error info: %s", __LINE__, \ full_filename, result, STRERROR(result)); return result; } remain_bytes -= read_bytes; if ((result=pContext->send_reply_chunk(pContext->arg, (remain_bytes == 0 && bLast) ? 1: 0, file_trunk_buff, read_bytes)) != 0) { return result; } } return 0; } int fdfs_http_request_handler(struct fdfs_http_context *pContext) { #define HTTPD_MAX_PARAMS 32 char *file_id_without_group; char *url; char file_id[128]; char uri[512]; int url_len; int uri_len; int flv_header_len; int param_count; int ext_len; KeyValuePair params[HTTPD_MAX_PARAMS]; char *p; char *filename; const char *ext_name; FDFSStorePaths *pStorePaths; char true_filename[128]; char full_filename[MAX_PATH_SIZE + 64]; //char content_type[64]; struct stat file_stat; int64_t file_offset; int64_t file_size; int64_t download_bytes; int filename_len; int full_filename_len; int store_path_index; int fd; int result; int http_status; int the_storage_port; int i; struct fdfs_http_response response; FDFSFileInfo file_info; bool bFileExists; bool bSameGroup; //if in my group bool bTrunkFile; FDFSTrunkFullInfo trunkInfo; memset(&response, 0, sizeof(response)); response.status = HTTP_OK; //logInfo("url=%s", pContext->url); url_len = strlen(pContext->url); if (url_len < 16) { logError("file: "__FILE__", line: %d, " \ "url length: %d < 16", __LINE__, url_len); OUTPUT_HEADERS(pContext, (&response), HTTP_BADREQUEST); return HTTP_BADREQUEST; } if (strncasecmp(pContext->url, "https://", 7) == 0) { p = strchr(pContext->url + 7, '/'); if (p == NULL) { logError("file: "__FILE__", line: %d, " \ "invalid url: %s", __LINE__, pContext->url); OUTPUT_HEADERS(pContext, (&response), HTTP_BADREQUEST); return HTTP_BADREQUEST; } uri_len = url_len - (p - pContext->url); url = p; } else { uri_len = url_len; url = pContext->url; } if (uri_len + 1 >= (int)sizeof(uri)) { logError("file: "__FILE__", line: %d, " \ "uri length: %d is too long, >= %d", __LINE__, \ uri_len, (int)sizeof(uri)); OUTPUT_HEADERS(pContext, (&response), HTTP_BADREQUEST); return HTTP_BADREQUEST; } if (*url != '/') { *uri = '/'; memcpy(uri+1, url, uri_len+1); uri_len++; } else { memcpy(uri, url, uri_len+1); } the_storage_port = storage_server_port; param_count = http_parse_query(uri, params, HTTPD_MAX_PARAMS); if (url_have_group_name) { int group_name_len; snprintf(file_id, sizeof(file_id), "%s", uri + 1); file_id_without_group = strchr(file_id, '/'); if (file_id_without_group == NULL) { logError("file: "__FILE__", line: %d, " \ "no group name in url, uri: %s", __LINE__, uri); OUTPUT_HEADERS(pContext, (&response), HTTP_BADREQUEST); return HTTP_BADREQUEST; } pStorePaths = &g_fdfs_store_paths; group_name_len = file_id_without_group - file_id; if (group_count == 0) { bSameGroup = (group_name_len == my_group_name_len) && \ (memcmp(file_id, my_group_name, \ group_name_len) == 0); } else { int i; bSameGroup = false; for (i=0; i<group_count; i++) { if (group_store_paths[i].group_name_len == \ group_name_len && memcmp(file_id, \ group_store_paths[i].group_name, \ group_name_len) == 0) { the_storage_port = group_store_paths[i]. \ storage_server_port; bSameGroup = true; pStorePaths = &group_store_paths[i].store_paths; break; } } } file_id_without_group++; //skip / } else { pStorePaths = &g_fdfs_store_paths; bSameGroup = true; file_id_without_group = uri + 1; //skip / snprintf(file_id, sizeof(file_id), "%s/%s", \ my_group_name, file_id_without_group); } if (strlen(file_id_without_group) < 22) { logError("file: "__FILE__", line: %d, " \ "file id is too short, length: %d < 22, " \ "uri: %s", __LINE__, \ (int)strlen(file_id_without_group), uri); OUTPUT_HEADERS(pContext, (&response), HTTP_BADREQUEST); return HTTP_BADREQUEST; } if (g_http_params.anti_steal_token) { char *token; char *ts; int timestamp; token = fdfs_http_get_parameter("token", params, param_count); ts = fdfs_http_get_parameter("ts", params, param_count); if (token == NULL || ts == NULL) { logError("file: "__FILE__", line: %d, " \ "expect parameter token or ts in url, " \ "uri: %s", __LINE__, uri); OUTPUT_HEADERS(pContext, (&response), HTTP_BADREQUEST); return HTTP_BADREQUEST; } timestamp = atoi(ts); if ((result=fdfs_http_check_token( \ &g_http_params.anti_steal_secret_key, \ file_id_without_group, timestamp, token, \ g_http_params.token_ttl)) != 0) { logError("file: "__FILE__", line: %d, " \ "check token fail, uri: %s, " \ "errno: %d, error info: %s", \ __LINE__, uri, result, STRERROR(result)); if (*(g_http_params.token_check_fail_content_type)) { response.content_length = g_http_params. \ token_check_fail_buff.length; response.content_type = g_http_params. \ token_check_fail_content_type; OUTPUT_HEADERS(pContext, (&response), HTTP_OK); pContext->send_reply_chunk(pContext->arg, 1, \ g_http_params.token_check_fail_buff.buff, g_http_params.token_check_fail_buff.length); return HTTP_OK; } else { OUTPUT_HEADERS(pContext, (&response), HTTP_BADREQUEST); return HTTP_BADREQUEST; } } } filename = file_id_without_group; filename_len = strlen(filename); //logInfo("filename=%s", filename); if (storage_split_filename_no_check(filename, \ &filename_len, true_filename, &store_path_index) != 0) { OUTPUT_HEADERS(pContext, (&response), HTTP_BADREQUEST); return HTTP_BADREQUEST; } if (bSameGroup) { if (store_path_index < 0 || \ store_path_index >= pStorePaths->count) { logError("file: "__FILE__", line: %d, " \ "filename: %s is invalid, " \ "invalid store path index: %d, " \ "which < 0 or >= %d", __LINE__, filename, \ store_path_index, pStorePaths->count); OUTPUT_HEADERS(pContext, (&response), HTTP_BADREQUEST); return HTTP_BADREQUEST; } } if (fdfs_check_data_filename(true_filename, filename_len) != 0) { OUTPUT_HEADERS(pContext, (&response), HTTP_BADREQUEST); return HTTP_BADREQUEST; } if ((result=fdfs_get_file_info_ex1(file_id, false, &file_info)) != 0) { if (result == ENOENT) { http_status = HTTP_NOTFOUND; } else if (result == EINVAL) { http_status = HTTP_BADREQUEST; } else { http_status = HTTP_INTERNAL_SERVER_ERROR; } OUTPUT_HEADERS(pContext, (&response), http_status); return http_status; } if (file_info.file_size >= 0) //normal file { FDFS_SET_LAST_MODIFIED(response, pContext, \ file_info.create_timestamp); } fd = -1; memset(&file_stat, 0, sizeof(file_stat)); if (bSameGroup) { FDFSTrunkHeader trunkHeader; if ((result=trunk_file_stat_ex1(pStorePaths, store_path_index, \ true_filename, filename_len, &file_stat, \ &trunkInfo, &trunkHeader, &fd)) != 0) { bFileExists = false; } else { bFileExists = true; } } else { bFileExists = false; memset(&trunkInfo, 0, sizeof(trunkInfo)); } response.attachment_filename = fdfs_http_get_parameter("filename", \ params, param_count); if (bFileExists) { if (file_info.file_size < 0) //slave or appender file { FDFS_SET_LAST_MODIFIED(response, pContext, \ file_stat.st_mtime); } } else { char *redirect; //logInfo("source id: %d", file_info.source_id); //logInfo("source ip addr: %s", file_info.source_ip_addr); //logInfo("create_timestamp: %d", file_info.create_timestamp); if (bSameGroup && (is_local_host_ip(file_info.source_ip_addr) \ || (file_info.create_timestamp > 0 && (time(NULL) - \ file_info.create_timestamp > storage_sync_file_max_delay)))) { if (IS_TRUNK_FILE_BY_ID(trunkInfo)) { if (result == ENOENT) { logError("file: "__FILE__", line: %d, "\ "logic file: %s not exist", \ __LINE__, filename); } else { logError("file: "__FILE__", line: %d, "\ "stat logic file: %s fail, " \ "errno: %d, error info: %s", \ __LINE__, filename, result, \ STRERROR(result)); } } else { snprintf(full_filename, \ sizeof(full_filename), "%s/data/%s", \ pStorePaths->paths[store_path_index].path, \ true_filename); if (result == ENOENT) { logError("file: "__FILE__", line: %d, "\ "file: %s not exist", \ __LINE__, full_filename); } else { logError("file: "__FILE__", line: %d, "\ "stat file: %s fail, " \ "errno: %d, error info: %s", \ __LINE__, full_filename, \ result, STRERROR(result)); } } OUTPUT_HEADERS(pContext, (&response), HTTP_NOTFOUND); return HTTP_NOTFOUND; } redirect = fdfs_http_get_parameter("redirect", \ params, param_count); if (redirect != NULL) { logWarning("file: "__FILE__", line: %d, " \ "redirect again, url: %s", \ __LINE__, url); OUTPUT_HEADERS(pContext, (&response), HTTP_BADREQUEST); return HTTP_BADREQUEST; } if (*(file_info.source_ip_addr) == '\0') { logWarning("file: "__FILE__", line: %d, " \ "can't get ip address of source storage " \ "id: %d, url: %s", __LINE__, \ file_info.source_id, url); OUTPUT_HEADERS(pContext, (&response), HTTP_INTERNAL_SERVER_ERROR); return HTTP_INTERNAL_SERVER_ERROR; } if (response_mode == FDFS_MOD_REPONSE_MODE_REDIRECT) { char *path_split_str; char port_part[16]; char param_split_char; if (pContext->server_port == 80) { *port_part = '\0'; } else { sprintf(port_part, ":%d", pContext->server_port); } if (param_count == 0) { param_split_char = '?'; } else { param_split_char = '&'; } if (*url != '/') { path_split_str = "/"; } else { path_split_str = ""; } response.redirect_url_len = snprintf( \ response.redirect_url, \ sizeof(response.redirect_url), \ "http://%s%s%s%s%c%s", \ file_info.source_ip_addr, port_part, \ path_split_str, url, \ param_split_char, "redirect=1"); logDebug("file: "__FILE__", line: %d, " \ "redirect to %s", \ __LINE__, response.redirect_url); if (pContext->if_range) { fdfs_format_range(pContext, &response); } OUTPUT_HEADERS(pContext, (&response), HTTP_MOVETEMP); return HTTP_MOVETEMP; } else if (pContext->proxy_handler != NULL) { return pContext->proxy_handler(pContext->arg, \ file_info.source_ip_addr); } } ext_name = fdfs_http_get_file_extension(true_filename, \ filename_len, &ext_len); /* if (g_http_params.need_find_content_type) { if (fdfs_http_get_content_type_by_extname(&g_http_params, \ ext_name, ext_len, content_type, sizeof(content_type)) != 0) { if (fd >= 0) { close(fd); } OUTPUT_HEADERS(pContext, (&response), HTTP_SERVUNAVAIL); return HTTP_SERVUNAVAIL; } response.content_type = content_type; } */ if (bFileExists) { file_size = file_stat.st_size; } else { bool if_get_file_info; if_get_file_info = pContext->header_only || \ (pContext->if_range && file_info.file_size < 0); if (if_get_file_info) { if ((result=fdfs_get_file_info_ex1(file_id, true, \ &file_info)) != 0) { if (result == ENOENT) { http_status = HTTP_NOTFOUND; } else { http_status = HTTP_INTERNAL_SERVER_ERROR; } OUTPUT_HEADERS(pContext, (&response), http_status); return http_status; } } file_size = file_info.file_size; } flv_header_len = 0; if (pContext->if_range) { if (fdfs_check_and_format_range(pContext, file_size) != 0 || (pContext->range_count > 1 && !g_http_params.support_multi_range)) { if (fd >= 0) { close(fd); } OUTPUT_HEADERS(pContext, (&response), HTTP_RANGE_NOT_SATISFIABLE); return HTTP_RANGE_NOT_SATISFIABLE; } if (pContext->range_count == 1) { download_bytes = FDFS_RANGE_LENGTH(pContext->ranges[0]); } else { download_bytes = fdfs_calc_download_bytes(pContext); } fdfs_format_content_range(pContext, file_size, &response); } else { download_bytes = file_size > 0 ? file_size : 0; //flv support if (flv_support && (flv_ext_len == ext_len && \ memcmp(ext_name, flv_extension, ext_len) == 0)) { char *pStart; pStart = fdfs_http_get_parameter("start", \ params, param_count); if (pStart != NULL) { int64_t start; if (fdfs_strtoll(pStart, &start) == 0) { char *pEnd; pContext->range_count = 1; pContext->ranges[0].start = start; pContext->ranges[0].end = 0; pEnd = fdfs_http_get_parameter("end", \ params, param_count); if (pEnd != NULL) { int64_t end; if (fdfs_strtoll(pEnd, &end) == 0) { pContext->ranges[0].end = end - 1; } } if (fdfs_check_and_format_range(pContext, file_size) != 0) { if (fd >= 0) { close(fd); } OUTPUT_HEADERS(pContext, (&response), HTTP_BADREQUEST); return HTTP_BADREQUEST; } download_bytes = FDFS_RANGE_LENGTH(pContext->ranges[0]); if (start > 0) { flv_header_len = sizeof(flv_header) - 1; } } } } } //logInfo("flv_header_len: %d", flv_header_len); if (pContext->header_only) { if (fd >= 0) { close(fd); } if (fdfs_calc_content_length(pContext, download_bytes, flv_header_len, ext_name, ext_len, &response) != 0) { OUTPUT_HEADERS(pContext, (&response), HTTP_SERVUNAVAIL); return HTTP_SERVUNAVAIL; } OUTPUT_HEADERS(pContext, (&response), pContext->if_range ? \ HTTP_PARTIAL_CONTENT : HTTP_OK ); return HTTP_OK; } if (fdfs_calc_content_length(pContext, download_bytes, flv_header_len, ext_name, ext_len, &response) != 0) { OUTPUT_HEADERS(pContext, (&response), HTTP_SERVUNAVAIL); return HTTP_SERVUNAVAIL; } if (!bFileExists) { ConnectionInfo storage_server; struct fdfs_download_callback_args callback_args; int64_t file_size; strcpy(storage_server.ip_addr, file_info.source_ip_addr); storage_server.port = the_storage_port; storage_server.sock = -1; callback_args.pContext = pContext; callback_args.pResponse = &response; callback_args.sent_bytes = 0; callback_args.range_index = 0; if (pContext->if_range) { download_bytes = FDFS_RANGE_LENGTH(pContext->ranges[0]); } result = storage_download_file_ex1(NULL, \ &storage_server, file_id, \ pContext->ranges[0].start, download_bytes, \ fdfs_download_callback, &callback_args, &file_size); logDebug("file: "__FILE__", line: %d, " \ "storage_download_file_ex1 return code: %d, " \ "file id: %s", __LINE__, result, file_id); if (result == 0) { http_status = HTTP_OK; } if (result == ENOENT) { http_status = HTTP_NOTFOUND; } else { http_status = HTTP_INTERNAL_SERVER_ERROR; } OUTPUT_HEADERS(pContext, (&response), http_status); if (result != 0 || !(pContext->if_range && pContext->range_count > 1)) { return http_status; } for (i=1; irange_count; i++) { callback_args.sent_bytes = 0; callback_args.range_index = i; download_bytes = FDFS_RANGE_LENGTH(pContext->ranges[i]); result = storage_download_file_ex1(NULL, &storage_server, file_id, pContext->ranges[i].start, download_bytes, fdfs_download_callback, &callback_args, &file_size); if (result != 0) { return HTTP_INTERNAL_SERVER_ERROR; } } if (fdfs_send_boundary(pContext, &response, true) != 0) { return HTTP_INTERNAL_SERVER_ERROR; } return http_status; } bTrunkFile = IS_TRUNK_FILE_BY_ID(trunkInfo); if (bTrunkFile) { trunk_get_full_filename_ex(pStorePaths, &trunkInfo, \ full_filename, sizeof(full_filename)); full_filename_len = strlen(full_filename); file_offset = TRUNK_FILE_START_OFFSET(trunkInfo) + \ pContext->ranges[0].start; } else { full_filename_len = snprintf(full_filename, \ sizeof(full_filename), "%s/data/%s", \ pStorePaths->paths[store_path_index].path, \ true_filename); file_offset = pContext->ranges[0].start; } if (pContext->send_file != NULL && !bTrunkFile && !(pContext->if_range && pContext->range_count > 1)) { http_status = pContext->if_range ? \ HTTP_PARTIAL_CONTENT : HTTP_OK; OUTPUT_HEADERS(pContext, (&response), http_status); if (flv_header_len > 0) { if (pContext->send_reply_chunk(pContext->arg, \ false, flv_header, flv_header_len) != 0) { close(fd); return HTTP_INTERNAL_SERVER_ERROR; } } return pContext->send_file(pContext->arg, full_filename, \ full_filename_len, file_offset, download_bytes); } if (fd < 0) { fd = open(full_filename, O_RDONLY); if (fd < 0) { logError("file: "__FILE__", line: %d, " \ "open file %s fail, " \ "errno: %d, error info: %s", __LINE__, \ full_filename, errno, STRERROR(errno)); OUTPUT_HEADERS(pContext, (&response), \ HTTP_SERVUNAVAIL); return HTTP_SERVUNAVAIL; } if (file_offset > 0 && lseek(fd, file_offset, SEEK_SET) < 0) { close(fd); logError("file: "__FILE__", line: %d, " \ "lseek file: %s fail, " \ "errno: %d, error info: %s", \ __LINE__, full_filename, \ errno, STRERROR(errno)); OUTPUT_HEADERS(pContext, (&response), HTTP_INTERNAL_SERVER_ERROR); return HTTP_INTERNAL_SERVER_ERROR; } } else { if (pContext->ranges[0].start > 0 && \ lseek(fd, pContext->ranges[0].start, SEEK_CUR) < 0) { close(fd); logError("file: "__FILE__", line: %d, " \ "lseek file: %s fail, " \ "errno: %d, error info: %s", \ __LINE__, full_filename, \ errno, STRERROR(errno)); OUTPUT_HEADERS(pContext, (&response), HTTP_INTERNAL_SERVER_ERROR); return HTTP_INTERNAL_SERVER_ERROR; } } OUTPUT_HEADERS(pContext, (&response), pContext->if_range ? \ HTTP_PARTIAL_CONTENT : HTTP_OK); if (pContext->if_range && pContext->range_count > 1) { if (fdfs_send_boundary(pContext, &response, false) != 0) { close(fd); return HTTP_INTERNAL_SERVER_ERROR; } if (fdfs_send_range_subheader(pContext, &response, 0) != 0) { close(fd); return HTTP_INTERNAL_SERVER_ERROR; } } if (flv_header_len > 0) { if (pContext->send_reply_chunk(pContext->arg, \ false, flv_header, flv_header_len) != 0) { close(fd); return HTTP_INTERNAL_SERVER_ERROR; } } if (pContext->if_range) { download_bytes = FDFS_RANGE_LENGTH(pContext->ranges[0]); } if (fdfs_send_file_buffer(pContext, full_filename, fd, download_bytes, !(pContext->if_range && pContext->range_count > 1)) != 0) { close(fd); return HTTP_INTERNAL_SERVER_ERROR; } if (!(pContext->if_range && pContext->range_count > 1)) { close(fd); return HTTP_OK; } for (i=1; irange_count; i++) { if (bTrunkFile) { file_offset = TRUNK_FILE_START_OFFSET(trunkInfo) + pContext->ranges[i].start; } else { file_offset = pContext->ranges[i].start; } if (lseek(fd, file_offset, SEEK_SET) < 0) { close(fd); logError("file: "__FILE__", line: %d, " \ "lseek file: %s fail, " \ "errno: %d, error info: %s", \ __LINE__, full_filename, \ errno, STRERROR(errno)); return HTTP_INTERNAL_SERVER_ERROR; } if (fdfs_send_boundary(pContext, &response, false) != 0) { close(fd); return HTTP_INTERNAL_SERVER_ERROR; } if (fdfs_send_range_subheader(pContext, &response, i) != 0) { close(fd); return HTTP_INTERNAL_SERVER_ERROR; } if (fdfs_send_file_buffer(pContext, full_filename, fd, FDFS_RANGE_LENGTH(pContext->ranges[i]), false) != 0) { close(fd); return HTTP_INTERNAL_SERVER_ERROR; } } close(fd); if (fdfs_send_boundary(pContext, &response, true) != 0) { return HTTP_INTERNAL_SERVER_ERROR; } return HTTP_OK; } static int fdfs_get_params_from_tracker() { IniContext iniContext; int result; bool continue_flag; continue_flag = false; if ((result=fdfs_get_ini_context_from_tracker(&g_tracker_group, &iniContext, &continue_flag,NULL)) != 0) { return result; } storage_sync_file_max_delay = iniGetIntValue(NULL, \ "storage_sync_file_max_delay", \ &iniContext, 24 * 3600); use_storage_id = iniGetBoolValue(NULL, "use_storage_id", \ &iniContext, false); iniFreeContext(&iniContext); if (use_storage_id) { result = fdfs_get_storage_ids_from_tracker_group( \ &g_tracker_group); } return result; } static int fdfs_format_http_datetime(time_t t, char *buff, const int buff_size) { struct tm tm; struct tm *ptm; *buff = '\0'; if ((ptm=gmtime_r(&t, &tm)) == NULL) { return errno != 0 ? errno : EFAULT; } strftime(buff, buff_size, "%a, %d %b %Y %H:%M:%S GMT", ptm); return 0; } static int fdfs_parse_range(char *value, struct fdfs_http_range *range) { int result; char *pEndPos; if (*value == '-') { if ((result=fdfs_strtoll(value, &(range->start))) != 0) { return result; } range->end = 0; return 0; } pEndPos = strchr(value, '-'); if (pEndPos == NULL) { return EINVAL; } *pEndPos = '\0'; if ((result=fdfs_strtoll(value, &(range->start))) != 0) { return result; } pEndPos++; //skip - if (*pEndPos == '\0') { range->end = 0; } else { if ((result=fdfs_strtoll(pEndPos, &(range->end))) != 0) { return result; } } return 0; } int fdfs_parse_ranges(const char *value, struct fdfs_http_context *pContext) { /* range format: bytes=500-999 bytes=-500 bytes=9500- */ #define RANGE_PREFIX_STR "bytes=" #define RANGE_PREFIX_LEN (int)(sizeof(RANGE_PREFIX_STR) - 1) int result; int len; int i; const char *p; char buff[256]; char *parts[FDFS_MAX_HTTP_RANGES]; len = strlen(value); if (len <= RANGE_PREFIX_LEN + 1) { return EINVAL; } p = value + RANGE_PREFIX_LEN; len -= RANGE_PREFIX_LEN; if (len >= (int)sizeof(buff)) { return EINVAL; } memcpy(buff, p, len); *(buff + len) = '\0'; result = 0; pContext->range_count = splitEx(buff, ',', parts, FDFS_MAX_HTTP_RANGES); for (i=0; irange_count; i++) { if ((result=fdfs_parse_range(parts[i], pContext->ranges + i)) != 0) { break; } } return result; } commic内容为以上还是报错In file included from /usr/local/fastdfs-nginx-module/src/ngx_http_fastdfs_module.c:6: /usr/local/fastdfs-nginx-module/src/common.c: In function ‘fdfs_mod_init’: /usr/local/fastdfs-nginx-module/src/common.c:230:9: error: ‘FDFS_CONNECT_TIMEOUT’ undeclared (first use in this function); did you mean ‘DEFAULT_CONNECT_TIMEOUT’? 230 | FDFS_CONNECT_TIMEOUT = iniGetIntValue(NULL, "connect_timeout", \ | ^~~~~~~~~~~~~~~~~~~~ | DEFAULT_CONNECT_TIMEOUT /usr/local/fastdfs-nginx-module/src/common.c:230:9: note: each undeclared identifier is reported only once for each function it appears in /usr/local/fastdfs-nginx-module/src/common.c:237:9: error: ‘FDFS_NETWORK_TIMEOUT’ undeclared (first use in this function); did you mean ‘DEFAULT_NETWORK_TIMEOUT’? 237 | FDFS_NETWORK_TIMEOUT = iniGetIntValue(NULL, "network_timeout", \ | ^~~~~~~~~~~~~~~~~~~~ | DEFAULT_NETWORK_TIMEOUT /usr/local/fastdfs-nginx-module/src/common.c:376:17: error: ‘FDFS_BASE_PATH_STR’ undeclared (first use in this function) 376 | FDFS_BASE_PATH_STR, url_have_group_name, buff, | ^~~~~~~~~~~~~~~~~~ /usr/local/fastdfs-nginx-module/src/common.c: In function ‘fdfs_get_params_from_tracker’: /usr/local/fastdfs-nginx-module/src/common.c:1601:21: error: too few arguments to function ‘fdfs_get_ini_context_from_tracker’ 1601 | if ((result=fdfs_get_ini_context_from_tracker(&g_tracker_group, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/fastdfs/fdfs_client.h:14, from /usr/local/fastdfs-nginx-module/src/common.c:29: /usr/include/fastdfs/tracker_proto.h:323:5: note: declared here 323 | int fdfs_get_ini_context_from_tracker(TrackerServerGroup *pTrackerGroup, \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc -c -I/usr/local/include/luajit-2.1 -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -Wno-error -DNDK_SET_VAR -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"' -I src/core -I src/event -I src/event/modules -I src/os/unix -I /www/server/nginx/src/ngx_devel_kit/objs -I objs/addon/ndk -I /www/server/nginx/src/lua_nginx_module/src/api -I /www/server/nginx/src/pcre-8.43 -I /www/server/nginx/src/openssl/.openssl/include -I /usr/include/libxml2 -I objs \ -o objs/ngx_modules.o \ objs/ngx_modules.c make[1]: *** [objs/Makefile:2254: objs/addon/src/ngx_http_fastdfs_module.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory '/www/server/nginx/src/nginx-1.24.0' make: *** [Makefile:10: build] Error 2

typedef struct { int count; // µ±Ç°ÎļþÊý¾Ý¼ÆÊý // unsigned long datetime; // µ±Ç°ÎļþµÄʱ¼ä´Á FIL file; // µ±Ç°Îļþ¶ÔÏó } DataFileInfo; static DataFileInfo data_file_info = {0, {0}};FRESULT res; FATFS fs; char dir_path[] = "0:/sample"; // Ä¿±êĿ¼ char filename[64]; if (data_file_info.count == 0) { //³õʼ»¯´æ´¢É豸 DSTATUS status = disk_initialize(0); if (status != 0) { printf("Disk initialize failed. Status: 0x%02X\n", status); return; } //¹ÒÔØÎļþϵͳ res = f_mount(0, &fs); if (res != FR_OK) { printf("Mount failed=%d\n", res); return; } // ¹Ø±Õ֮ǰ´ò¿ªµÄÎļþ if (data_file_info.file.fs) { f_close(&data_file_info.file); } //È·±£Ä¿±êĿ¼´æÔÚ FILINFO fno; res = f_stat(dir_path, &fno); if (res == FR_NO_FILE) { // Ŀ¼²»´æÔÚ res = f_mkdir(dir_path); // ´´½¨Ä¿Â¼ if (res != FR_OK) { printf("Ŀ¼´´½¨Ê§°Ü %s: %d\n", dir_path, res); return; } } else if (res != FR_OK) { printf("Ŀ¼·ÃÎÊ´íÎó: %d\n", res); return; } // Éú³É´øÂ·¾¶µÄÎļþÃû snprintf(filename, sizeof(filename), "%s/sampleDeta20%02d%02d%02d%02d%02d%02d.txt", dir_path, year, month, day, hour, minute, second); // ´´½¨ÐÂÎļþ res = f_open(&data_file_info.file, filename, FA_CREATE_ALWAYS | FA_WRITE); if (res != FR_OK) { printf("Îļþ´´½¨Ê§°Ü %s: %d\n", filename, res); // return; }else{ printf("Îļþ´´½¨³É¹¦"); f_open(&data_file_info.file, filename, FA_CREATE_ALWAYS | FA_WRITE); } } // дÈëÊý¾Ý char data_line[50]; snprintf(data_line, sizeof(data_line), "20%02d-%02d-%02d %02d:%02d:%02d %.2f V\r\n", year, month, day, hour, minute, second, vol_value); UINT bw; // f_open(&data_file_info.file, filename, FA_CREATE_ALWAYS | FA_WRITE); res = f_write(&data_file_info.file, data_line, strlen(data_line), &bw); // f_close(&data_file_info.file); // f_mount(0, NULL);//Ð¶ÔØÎļþϵͳ if (res != FR_OK || bw != strlen(data_line)) { printf("Êý¾ÝдÈëʧ°Ü: %d\n", res); } else { f_sync(&data_file_info.file); data_file_info.count++; // ´ïµ½10ÌõÊý¾ÝºóÖØÖà if (data_file_info.count >= 10) { data_file_info.count = 0; f_mount(0, NULL);//Ð¶ÔØÎļþϵͳ } }封装成函数,参数是char dir_path[] = "0:/sample"; 目标目录

vae@vae-ASUS-TUF-Gaming-A15-FA507UU-FA507UU:~/qpOASES$ make SHARED=yes Creating /home/vae/qpOASES/src/LAPACKReplacement.o Creating /home/vae/qpOASES/src/BLASReplacement.o Creating SQProblem.o SQProblem.cpp: In member function ‘qpOASES::returnValue qpOASES::SQProblem::hotstart(qpOASES::SymmetricMatrix*, const real_t*, qpOASES::Matrix*, const real_t*, const real_t*, const real_t*, const real_t*, qpOASES::int_t&, qpOASES::real_t*, const qpOASES::Bounds*, const qpOASES::Constraints*)’: SQProblem.cpp:116:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 116 | if ( cputime != 0 ) | ^~ SQProblem.cpp:121:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 121 | if ( setupNewAuxiliaryQP( H_new,A_new,lb_new,ub_new,lbA_new,ubA_new ) != SUCCESSFUL_RETURN ) | ^~ SQProblem.cpp: In member function ‘qpOASES::returnValue qpOASES::SQProblem::hotstart(const real_t*, const real_t*, const real_t*, const real_t*, const real_t*, const real_t*, const real_t*, qpOASES::int_t&, qpOASES::real_t*, const qpOASES::Bounds*, const qpOASES::Constraints*)’: SQProblem.cpp:165:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 165 | if ( cputime != 0 ) | ^~ SQProblem.cpp:170:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 170 | if ( setupNewAuxiliaryQP( H_new,A_new,lb_new,ub_new,lbA_new,ubA_new ) != SUCCESSFUL_RETURN ) | ^~ Creating QProblem.o QProblem.cpp: In member function ‘qpOASES::returnValue qpOASES::QProblem::updateFarBounds(qpOASES::real_t, qpOASES::int_t, const real_t*, qpOASES::real_t*, const real_t*, qpOASES::real_t*, const real_t*, qpOASES::real_t*, const real_t*, qpOASES::real_t*) const’: QProblem.cpp:5483:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 5483 | if ( returnvalue != SUCCESSFUL_RETURN ) | ^~ QProblem.cpp:5486:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 5486 | if ( options.enableRamping == BT_TRUE ) | ^~ QProblem.cpp: In member function ‘qpOASES::returnValue qpOASES::QProblem::printIteration(qpOASES::int_t, qpOASES::int_t, qpOASES::SubjectToStatus, qpOASES::BooleanType, qpOASES::real_t, qpOASES::BooleanType)’: QProblem.cpp:6213:76: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size between 119 and 135 [-Wformat-truncation=] 6213 | snprintf( myPrintfString,MAX_STRING_LENGTH," %5.1d | %1.6e | %s %4.1d | %4.1d | %4.1d \n", (int)iter,tau,info,(int)BC_idx,(int)getNFX( ),(int)getNAC( ) ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Indexlist.hpp:40, from /home/vae/qpOASES/include/qpOASES/SubjectTo.hpp:40, from /home/vae/qpOASES/include/qpOASES/Bounds.hpp:40, from /home/vae/qpOASES/include/qpOASES/Flipper.hpp:40, from /home/vae/qpOASES/include/qpOASES/QProblemB.hpp:42, from /home/vae/qpOASES/include/qpOASES/QProblem.hpp:41, from QProblem.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 55 and 251 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ QProblem.cpp:6198:78: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size between 118 and 134 [-Wformat-truncation=] 6198 | snprintf( myPrintfString,MAX_STRING_LENGTH," %5.1d* | %1.6e | %s SOLVED | %4.1d | %4.1d \n", (int)iter,tau,info,(int)getNFX( ),(int)getNAC( ) ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Indexlist.hpp:40, from /home/vae/qpOASES/include/qpOASES/SubjectTo.hpp:40, from /home/vae/qpOASES/include/qpOASES/Bounds.hpp:40, from /home/vae/qpOASES/include/qpOASES/Flipper.hpp:40, from /home/vae/qpOASES/include/qpOASES/QProblemB.hpp:42, from /home/vae/qpOASES/include/qpOASES/QProblem.hpp:41, from QProblem.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 60 and 249 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ QProblem.cpp:6196:78: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size between 118 and 134 [-Wformat-truncation=] 6196 | snprintf( myPrintfString,MAX_STRING_LENGTH," %5.1d | %1.6e | %s SOLVED | %4.1d | %4.1d \n", (int)iter,tau,info,(int)getNFX( ),(int)getNAC( ) ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Indexlist.hpp:40, from /home/vae/qpOASES/include/qpOASES/SubjectTo.hpp:40, from /home/vae/qpOASES/include/qpOASES/Bounds.hpp:40, from /home/vae/qpOASES/include/qpOASES/Flipper.hpp:40, from /home/vae/qpOASES/include/qpOASES/QProblemB.hpp:42, from /home/vae/qpOASES/include/qpOASES/QProblem.hpp:41, from QProblem.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 60 and 249 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Creating QProblemB.o QProblemB.cpp: In member function ‘qpOASES::returnValue qpOASES::QProblemB::changeActiveSet(qpOASES::int_t, qpOASES::SubjectToStatus)’: QProblemB.cpp:3380:4: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation] 3380 | else | ^~~~ QProblemB.cpp:3382:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’ 3382 | getGlobalMessageHandler( )->throwInfo( RET_ADD_TO_ACTIVESET,messageString,__FUNC__,__FILE__,__LINE__,VS_VISIBLE ); | ^~~~~~~~~~~~~~~~~~~~~~~ QProblemB.cpp: In member function ‘qpOASES::returnValue qpOASES::QProblemB::printIteration(qpOASES::int_t, qpOASES::int_t, qpOASES::SubjectToStatus, qpOASES::real_t, qpOASES::BooleanType)’: QProblemB.cpp:3828:76: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size between 119 and 135 [-Wformat-truncation=] 3828 | snprintf( myPrintfString,MAX_STRING_LENGTH," %5.1d | %1.6e | %s %4.1d | %4.1d \n", (int)iter,tau,info,(int)BC_idx,(int)getNFX( ) ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Indexlist.hpp:40, from /home/vae/qpOASES/include/qpOASES/SubjectTo.hpp:40, from /home/vae/qpOASES/include/qpOASES/Bounds.hpp:40, from /home/vae/qpOASES/include/qpOASES/Flipper.hpp:40, from /home/vae/qpOASES/include/qpOASES/QProblemB.hpp:42, from QProblemB.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 45 and 234 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ QProblemB.cpp:3818:78: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size between 118 and 134 [-Wformat-truncation=] 3818 | snprintf( myPrintfString,MAX_STRING_LENGTH," %5.1d* | %1.6e | %s SOLVED | %4.1d \n", (int)iter,tau,info,(int)getNFX( ) ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Indexlist.hpp:40, from /home/vae/qpOASES/include/qpOASES/SubjectTo.hpp:40, from /home/vae/qpOASES/include/qpOASES/Bounds.hpp:40, from /home/vae/qpOASES/include/qpOASES/Flipper.hpp:40, from /home/vae/qpOASES/include/qpOASES/QProblemB.hpp:42, from QProblemB.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 50 and 232 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ QProblemB.cpp:3816:78: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size between 118 and 134 [-Wformat-truncation=] 3816 | snprintf( myPrintfString,MAX_STRING_LENGTH," %5.1d | %1.6e | %s SOLVED | %4.1d \n", (int)iter,tau,info,(int)getNFX( ) ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Indexlist.hpp:40, from /home/vae/qpOASES/include/qpOASES/SubjectTo.hpp:40, from /home/vae/qpOASES/include/qpOASES/Bounds.hpp:40, from /home/vae/qpOASES/include/qpOASES/Flipper.hpp:40, from /home/vae/qpOASES/include/qpOASES/QProblemB.hpp:42, from QProblemB.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 50 and 232 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Creating SQProblemSchur.o Creating Bounds.o Creating Constraints.o Creating SubjectTo.o Creating Indexlist.o Creating Flipper.o Creating Utils.o Creating Options.o Options.cpp: In member function ‘qpOASES::returnValue qpOASES::Options::print() const’: Options.cpp:386:80: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size 126 [-Wformat-truncation=] 386 | snprintf( myPrintfString,MAX_STRING_LENGTH,"printLevel = %s\n",info ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Options.hpp:40, from Options.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 36 and 195 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Options.cpp:392:80: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size 126 [-Wformat-truncation=] 392 | snprintf( myPrintfString,MAX_STRING_LENGTH,"enableRamping = %s\n",info ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Options.hpp:40, from Options.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 36 and 195 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Options.cpp:396:80: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size 126 [-Wformat-truncation=] 396 | snprintf( myPrintfString,MAX_STRING_LENGTH,"enableFarBounds = %s\n",info ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Options.hpp:40, from Options.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 36 and 195 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Options.cpp:400:80: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size 126 [-Wformat-truncation=] 400 | snprintf( myPrintfString,MAX_STRING_LENGTH,"enableFlippingBounds = %s\n",info ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Options.hpp:40, from Options.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 36 and 195 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Options.cpp:404:80: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size 126 [-Wformat-truncation=] 404 | snprintf( myPrintfString,MAX_STRING_LENGTH,"enableRegularisation = %s\n",info ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Options.hpp:40, from Options.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 36 and 195 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Options.cpp:408:80: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size 126 [-Wformat-truncation=] 408 | snprintf( myPrintfString,MAX_STRING_LENGTH,"enableFullLITests = %s\n",info ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Options.hpp:40, from Options.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 36 and 195 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Options.cpp:412:80: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size 126 [-Wformat-truncation=] 412 | snprintf( myPrintfString,MAX_STRING_LENGTH,"enableNZCTests = %s\n",info ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Options.hpp:40, from Options.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 36 and 195 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Options.cpp:422:80: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size 126 [-Wformat-truncation=] 422 | snprintf( myPrintfString,MAX_STRING_LENGTH,"enableEqualities = %s\n",info ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Options.hpp:40, from Options.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 36 and 195 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Options.cpp:426:80: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size 126 [-Wformat-truncation=] 426 | snprintf( myPrintfString,MAX_STRING_LENGTH,"enableInertiaCorrection = %s\n",info ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Options.hpp:40, from Options.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 36 and 195 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Options.cpp:470:80: warning: ‘%s’ directive output may be truncated writing up to 159 bytes into a region of size 126 [-Wformat-truncation=] 470 | snprintf( myPrintfString,MAX_STRING_LENGTH,"initialStatusBounds = %s\n",info ); | ^~ ~~~~ In file included from /usr/include/stdio.h:867, from /home/vae/qpOASES/include/qpOASES/MessageHandling.hpp:39, from /home/vae/qpOASES/include/qpOASES/Utils.hpp:39, from /home/vae/qpOASES/include/qpOASES/Options.hpp:40, from Options.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 36 and 195 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Creating Matrices.o Creating MessageHandling.o MessageHandling.cpp: In member function ‘qpOASES::returnValue qpOASES::MessageHandling::throwMessage(qpOASES::returnValue, const char*, const char*, const char*, long unsigned int, qpOASES::VisibilityStatus, const char*)’: MessageHandling.cpp:517:50: warning: ‘->’ directive output may be truncated writing 2 bytes into a region of size between 1 and 160 [-Wformat-truncation=] 517 | snprintf( myPrintfString,MAX_STRING_LENGTH,"%s->", whitespaces ); | ^~ In file included from /usr/include/stdio.h:867, from MessageHandling.cpp:36: /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 3 and 162 bytes into a destination of size 160 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Creating SparseSolver.o Creating SolutionAnalysis.o Creating OQPinterface.o Creating static lib /home/vae/qpOASES/bin/libqpOASES.a ar: 正在创建 /home/vae/qpOASES/bin/libqpOASES.a Creating shared lib /home/vae/qpOASES/bin/libqpOASES.so Creating example1.o Creating /home/vae/qpOASES/bin/example1 Creating example1a.o Creating /home/vae/qpOASES/bin/example1a Creating example1b.o Creating /home/vae/qpOASES/bin/example1b Creating example2.o Creating /home/vae/qpOASES/bin/example2 Creating example3.o Creating /home/vae/qpOASES/bin/example3 Creating example3b.o Creating /home/vae/qpOASES/bin/example3b Creating example4.o Creating /home/vae/qpOASES/bin/example4 Creating example5.o Creating /home/vae/qpOASES/bin/example5 Creating exampleLP.o Creating /home/vae/qpOASES/bin/exampleLP Creating qrecipe.o Creating /home/vae/qpOASES/bin/qrecipe Creating qrecipeSchur.o Creating /home/vae/qpOASES/bin/qrecipeSchur vae@vae-ASUS-TUF-Gaming-A15-FA507UU-FA507UU:~/qpOASES$ make python cd ./interfaces/python/ && python3 setup.py build_ext --inplace Compiling qpoases.pyx because it changed. [1/1] Cythonizing qpoases.pyx Error compiling Cython file: ------------------------------------------------------------ ... np.ndarray[np.double_t, ndim=1] maxStat, np.ndarray[np.double_t, ndim=1] maxFeas, np.ndarray[np.double_t, ndim=1] maxCmpl ): cdef real_t ret # 统一使用qpOASES::real_t ret = self.thisptr->getKktViolation( ^ ------------------------------------------------------------ qpoases.pyx:811:26: Syntax error in simple statement list Traceback (most recent call last): File "setup.py", line 27, in <module> ext_modules=cythonize(ext_modules, language_level=3), # 指定Python 3语法 File "/home/vae/.local/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1115, in cythonize cythonize_one(*args) File "/home/vae/.local/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1238, in cythonize_one raise CompileError(None, pyx_file) Cython.Compiler.Errors.CompileError: qpoases.pyx make: *** [Makefile:80:python] 错误 1

最新推荐

recommend-type

安全函数strcpy_s、strncpy_s、snprintf_s、memcpy_s

它的语法是`snprintf_s(dest, size, max_chars, format, ...)`,其中`max_chars`是最大写入字符数(包括终止空字符),`format`是格式化字符串,后面的参数是格式化字符串中的占位符对应的值。 4. **memcpy_s**: 这...
recommend-type

【地球科学与遥感】基于Google Earth Engine的哨兵2号数据分析:研究区域NDVI、LST及城市热岛效应评估系统设计

内容概要:本文档提供了一套完整的Python脚本,利用Google Earth Engine (GEE) API对哨兵2号卫星影像进行处理与分析。首先,导入必要的库(如ee、geemap、geopandas),并通过Google Drive加载GeoJSON文件定义研究区域。接着,对哨兵2号Harmonized数据进行预处理,包括云掩膜、日期筛选和区域过滤。然后,基于红波段和近红外波段计算归一化植被指数(NDVI),并进一步推算地表温度(LST)。最后,通过计算研究区域内的LST均值和标准差,构建标准化城市热岛指数(UHI)和城市热场变异指数(UTFVI),并将其可视化于交互式地图中。 适合人群:具备一定遥感和地理信息系统(GIS)基础知识的研究人员和技术人员,特别是从事环境监测、城市规划或气候变化相关领域的工作者。 使用场景及目标:① 对特定区域内的植被覆盖和地表温度进行动态监测;② 分析城市热岛效应及其空间分布特征;③ 辅助城市规划和环境管理决策,提高应对气候变化的能力。 阅读建议:此资源侧重于实际应用中的遥感数据分析流程,建议读者熟悉Python编程语言和GEE平台的基本操作,同时结合具体的科学问题来理解和实践代码中的各个步骤。在学习过程中应关注数据处理逻辑与方法论的应用,确保能够独立完成类似的数据分析任务。
recommend-type

2025二级建造师继续教育考试题库带有答案.docx

2025二级建造师继续教育考试题库带有答案.docx
recommend-type

Typora下载问题解决:资源安装包实测可用

### 知识点:Typora下载与安装问题解决 #### 1. Typora 简介 Typora 是一款流行的轻量级Markdown编辑器,它将实时预览功能和源代码编辑结合在一起,为用户提供了一个简洁高效的写作环境。由于其独特的设计和出色的用户体验,Typora 迅速在开发者和内容创作者之间获得了普及。 #### 2. Markdown 简介 Markdown 是一种轻量级标记语言,它允许人们使用易读易写的纯文本格式编写文档,然后转换成有效的XHTML(或者HTML)文档。Markdown 被广泛用于编写 README 文件、撰写文章、创建富文本内容等。其特点在于简化了传统的排版语法,让写作更加专注于内容本身。 #### 3. Typora 的特点和优势 - **所见即所得编辑器**:Typora 结合了传统Markdown编辑器和富文本编辑器的优点,使得用户在编写文档时可以直接看到最终效果。 - **跨平台兼容性**:Typora 支持Windows、macOS以及Linux等多个操作系统。 - **简洁的界面**:它拥有简洁的用户界面,没有复杂的菜单,这有助于减少分心,专注于内容创作。 - **即时预览**:Typora 提供即时预览功能,用户可以立即看到其标记语法对应的视觉效果。 - **集成度高**:支持插入图片、代码块、表格、数学公式等多种格式。 - **扩展性**:支持多种主题和插件,可以进一步增强其功能。 #### 4. 关于标题:“关于Typora下载找不到资源” 当用户在寻找Typora的下载资源时,可能会遇到找不到官方下载链接或被错误资源误导的问题。这可能是由于网络环境限制、搜索关键词不当或者不正确的网站导航等原因导致的。为了解决这个问题,重要的是要知道如何辨别官方下载渠道,以及如何查找和验证可靠的资源。 #### 5. 官方资源的识别和下载 - **访问官方网站**:访问 Typora 的官方网站(https://typora.io/)获取最新版本的下载信息。官方网站是获取软件的最安全和最可靠的方式。 - **下载安装包**:官方网站通常会提供最新版本的安装包下载链接,例如,在此案例中,压缩包子文件名列表中的 typora-setup-x64-0.9.49.exe 对应了 Typora 的一个版本号为 0.9.49 的安装程序,适用于64位Windows系统。 - **检查版本更新**:在安装之前,用户应当确认是否是当前最新版本。如果不是,可从官方网站下载最新版本。 #### 6. 安装包文件名称解析 文件名 typora-setup-x64-0.9.49.exe 中的各部分含义: - **typora**:指的是要安装的软件名。 - **setup**:通常表示这是一个安装程序。 - **x64**:表示这个安装程序支持64位系统架构。 - **0.9.49**:表示这个版本号,用户可以通过这个版本号了解其更新历史和功能改进情况。 #### 7. 实测完成 “实测完成”这一描述表明此文件已经过测试,并确认可以正常下载和安装。实测的流程包括下载安装包、运行安装程序、完成安装以及验证软件功能是否正常。 #### 8. 安装流程详解 1. **下载**:从官方网站下载对应操作系统版本的 Typora 安装包。 2. **运行安装程序**:双击下载的安装程序文件(例如 typora-setup-x64-0.9.49.exe)。 3. **安装向导**:安装向导启动后,遵循提示完成安装。可能包含选择安装路径、接受许可协议、选择开始菜单文件夹等步骤。 4. **完成安装**:完成安装向导后,可能需要重启电脑以完成安装。 5. **验证安装**:启动 Typora 程序,检查软件是否能够正常打开,并确保可以正常使用Markdown编辑功能。 #### 9. 常见问题及解决方案 - **找不到下载资源**:确保访问官方网站或使用正规的软件分发平台获取资源。 - **安装程序无法运行**:检查文件是否有损坏,重新下载安装包。确认系统环境满足安装需求,如操作系统版本兼容性、运行库等。 - **软件无法打开**:尝试以管理员权限运行 Typora,或检查是否有系统安全软件阻止其运行。 - **功能异常或错误**:检查是否有可用的软件更新,或者查看 Typora 官方论坛获取帮助。 #### 10. Typora 的未来展望 由于 Typora 不断更新迭代,功能和用户界面可能会有所改变,包括对新特性的支持和旧特性的优化。同时,开发者社区也在不断地为 Typora 开发新的主题和插件,以提供更加丰富的写作体验和扩展功能。用户应定期访问官方网站或关注官方消息,以便获取最新动态和软件更新。 通过以上介绍和问题解答,用户应该可以更好地理解 Typora 的下载与安装过程,并在遇到相关问题时快速找到解决方法,从而顺利使用这款强大的Markdown编辑器。
recommend-type

网络嗅探器实战进阶:掌握高效数据捕获与准确分析的6大策略

# 1. 网络嗅探器基础原理与工具介绍 网络嗅探器,或称为网络分析器、包分析器,是一种用于捕获网络中的数据包并分析其内容的工具。它们通过直接连接到网络上,读取传输中的数据包信息,为网络安全、故障排除和网络性
recommend-type

system verilog task中用宏定义传参

<think>好的,用户现在想了解如何在SystemVerilog中使用宏定义向task传递参数。之前我已经回答了C/C++中宏定义传参的方法,现在需要迁移到SystemVerilog,同时结合用户提供的引用内容。 首先,我需要回忆SystemVerilog中宏的基本语法,确认是否与C/C++类似。SystemVerilog确实支持`define宏,带参数的形式应该也是类似的。用户提供的引用中提到`__FILE__`和`__LINE__`,这些可能和调试有关,所以可能需要考虑在宏中加入这些信息来帮助调试。 接下来,用户的问题是关于如何通过宏向task传参。这里的task应该是指System
recommend-type

Java开发的Help GUI 1.1源码:可视化组件库详解

在分析给定文件信息后,可以提取出如下知识点: 首先,标题中提到了“基于java的开发源码-帮助视图组件库 Help GUI 1.1源代码.zip”,这说明文件包含了一个Java开发的开源项目,该库被命名为Help GUI,版本为1.1。在此基础上,我们可以讨论以下几个方面: 1. Java开发: - Java是一种广泛使用的面向对象的编程语言,它具有跨平台的特性,即“一次编写,到处运行”的能力。Java通过Java虚拟机(JVM)来实现跨平台运行。 - Java的开发环境一般需要配置Java开发工具包(JDK)和集成开发环境(IDE),如Eclipse、IntelliJ IDEA或PyCharm。 - Java支持多线程编程,拥有丰富的类库和框架,如Spring、Hibernate等,用以简化开发流程。 - Java在企业级应用、移动开发(Android)、桌面应用和服务器端应用中都有广泛的应用。 2. 开源项目: - 开源项目是指源代码公开的软件项目,通常遵循特定的开源许可协议,如GPL、LGPL、Apache License等。 - 开源项目的优势在于可自由使用、修改和分发代码,能够促进技术的交流和创新。 - 通过参与开源项目,开发者可以提高自身的技术水平,贡献代码以回馈社区。 3. 组件库Help GUI 1.1: - Help GUI可能是一个为开发者提供的图形用户界面(GUI)组件库,用于简化Java桌面应用的帮助视图创建。 - 组件库一般会包含一系列预制的用户界面组件,例如按钮、文本框、列表框、对话框等,以帮助快速构建用户界面。 - 版本1.1表明这是组件库的一个更新版本,通常新版本会增加新的特性、修复bug、优化性能。 4. PyCharm配置Python环境: - 这部分描述似乎与主标题无关,但其可能涉及PyCharm这一IDE的使用。 - PyCharm是专为Python语言开发的IDE,但也可以配置Java开发环境。 - 在配置Python环境时,需要安装Python解释器,并设置相关的路径、环境变量等。 - PyCharm提供了代码高亮、代码自动完成、版本控制等功能,能够提升开发效率。 由于【压缩包子文件的文件名称列表】中只有一个“codefans.net”,这可能是一个网站地址,但没有提供足够的信息来推断与上述Java项目或组件库直接相关的内容。 综上所述,文件描述了一个基于Java的开源组件库Help GUI 1.1,该组件库用于帮助开发者创建帮助视图,且暗示了PyCharm这一IDE的使用。通过探讨Java开发、开源项目、组件库和IDE配置等知识点,可以更好地理解文件所指的项目背景和应用场景。
recommend-type

网络嗅探器全攻略:从入门到精通的15大技巧与实践案例

# 1. 网络嗅探器基础与重要性 在数字化的世界中,网络嗅探器是IT专业人员的重要工具,它允许我们监视和分析经过网络的数据包。本章将带您了解网络嗅探器的基本概念及其在网络安全和性能监控中的关键作用。 ## 网络嗅探器概述 网络嗅探器,通常被称为“抓包工具”或“协议分析器”,是一种可以监听、记录和分析网络流量的程序或设备。它们在排除网络问题、进行安全审计和协议分析时发挥着重要作用。 ##
recommend-type

RTL8720DN-VA1-CG后面的VA1-CG是什么意思

<think>嗯,用户这次的问题转向了具体的芯片型号解析,询问RTL8720DN-VA1-CG后缀的含义。这属于硬件标识领域的专业问题,需要结合芯片命名规则和行业惯例来分析。 从用户提问方式看,ta应该具备一定技术背景,可能是电子工程师或物联网开发者,正在做物料选型或故障排查。用户特意强调"参考站内引用"但实际没有引用源,说明需要权威解释而非普通科普。之前讨论Wi-Fi频段差异时用户表现出对技术参数的敏感,这次提问同样注重细节标识。 关于这个型号后缀,需要拆解三部分分析: VA1通常代表芯片修订版本(revision),比如初版叫VA0,改进版叫VA1。CG后缀可能有多种含义:最常见的是封
recommend-type

CCPD2019车牌数据集:10000张带YOLO标签图片

车牌检测是计算机视觉领域的一个重要应用,尤其在智能交通系统、监控视频分析以及车辆管理等方面具有广泛的应用。CCPD2019车牌数据集是专为车牌检测任务设计的数据集,包含了大量的实际场景中拍摄的车辆图片及其对应的标注信息,这些标注信息以YOLO(You Only Look Once)格式提供。 YOLO是一种流行的目标检测算法,因其速度和准确性相结合而受到广泛欢迎。在YOLO算法中,整个图像被一次性通过网络进行处理,同时预测出多个边界框和这些框所属的类别。YOLO将目标检测任务视为一个回归问题,直接从图像像素到边界框坐标和类别概率的映射,与其他基于区域的方法相比,YOLO在速度上有很大的优势,可以实现实时检测。 YOLO格式标签是一种特殊的标注格式,它提供了用于训练和验证模型的数据。这些标签通常包含每个目标的类别以及它的位置信息,通常在一张图片的标注文件中,对于每一个检测到的车辆,都会有一个对应的标注行,标注行中包含了该车辆车牌的位置、大小和类别信息。通常这些信息包括:标注物体在原图中的中心点坐标(x,y)、宽度、高度以及类别ID。 使用CCPD2019车牌数据集,研究人员和工程师可以进行深度学习模型的训练,特别是基于YOLO算法的车牌检测模型。数据集中的图片是精心挑选的,包含了各种光照条件、不同角度和遮挡情况下的车牌图像,这对于提高模型在现实世界中检测的准确性和鲁棒性至关重要。 在深度学习中,训练模型需要大量的标注数据。一个高质量的数据集对于模型能否成功学习到目标检测中的关键特征是至关重要的。CCPD2019车牌数据集提供的10000张图片以及它们的YOLO格式标签,能够为模型提供充足的训练材料。这些标签通常都是由人工仔细标注,确保了标注的质量和准确性。 深度学习在车牌识别系统中的应用是多方面的,不仅包括检测车牌的位置,还包括车牌字符的分割和识别。在实际应用中,经过训练的YOLO模型首先对输入图像中的车牌区域进行定位,然后可以通过其他专门设计的深度学习模型对车牌上的文字进行识别。 CCPD2019车牌数据集对于研究和开发车牌识别技术具有重要价值,它有助于推动计算机视觉领域特别是车牌检测和识别技术的发展。通过深度学习,特别是使用YOLO这样的先进算法,可以实现车牌的快速准确识别,这对于智能交通管理、车辆安全监控和交通流量分析等应用具有十分重要的意义。