M/在Makefile中进行宏定义-D

本文详细介绍了如何使用GCC编译器的宏定义功能,包括通过makefile中的CFLAGS选项定义宏,以及宏定义如何影响源代码的编译过程。通过实例展示了预处理宏的定义方式及其在条件编译中的应用。

在源代码里面如果这样是定义的:
#ifdef   MACRONAME
//可选代码
#endif

那在makefile里面
gcc   -D   MACRONAME=MACRODEF
或者
gcc   -D   MACRONAME 


这样就定义了预处理宏,编译的时候可选代码就会被编译进去了。

对于GCC编译器,有如下选项:
        -D macro=string,等价于在头文件中定义:#define   macro   string。例如:-D TRUE=true,等价于:#define   TRUE   true
        -D macro,等价于在头文件中定义:#define   macro   1,实际上也达到了定义:#define   macro的目的。例如:-D Linux,等价于:#define   LINUX   1(与#define   LINUX作用类似)。
        --define-macro   macro=string与-D macro=string作用相同。

如:

TEST.C 文件

#include <stdio.h>
#include <stdlib.h>

main()
{
#ifdef p1
  printf("Hello p1");
#else
  printf("Hello p2");
#endif
 
}

1.

编译: gcc -o test test.c

运行: ./test

输出: Hello p2

2.

编译: gcc -o test test.c -D p1

运行: ./test

输出: Hello p1

 

关键词: Make宏定义 Make传递宏定义 Makefile中添加宏定义 Makefile -D

在Makefile中我们可以通过宏定义来控制源程序的编译。只要在Makefile中的CFLAGS中通过选项-D来指定你于定义的宏即可。

如:
CFLAGS += -D _YUQIANG

在编译的时候加上此选项就可以了: $(CC) $(CFLAGS) $^ -o $@ 

在makefile 中

clude -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -Wall -Werror -ffunction-sections -fdata-sections -DMODULE_LIST="\"tdpd tmpd mactool nifc ipcd dhcpc diagnose httpd tpntp system upgrade arp_scanner\"" -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/include -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common/ds -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/mactool -I./libXml -I./libutils -I./libmediautil -I../../include -c -o arp_handle.o arp_handle.c arm-ca9-linux-uclibcgnueabihf-ar crus -o arp_scanner.a arp_scan.o arp_data.o arp.o arp_handle.o cp -f arp_scanner.a ../../libraries/ mkdir -p ../../files/ cp -fpR ./files/* ../../files/ make[4]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/arp_scanner' arm-ca9-linux-uclibcgnueabihf-gcc -O2 -pipe -fgnu89-inline -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard -ftree-vectorize -fno-builtin -fno-common -g -Wno-stringop-truncation -Wno-format-truncation -Wno-sizeof-pointer-div -Wno-stringop-overflow -Wno-format-overflow -Wno-sizeof-pointer-memaccess -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -DCONFIG_STATISTIC_REPORT_DOMAIN=n-da.tplinkcloud.com.cn -Wno-sizeof-pointer-div -Wno-restrict -Wno-format-truncation -Wno-format-overflow -Wno-stringop-truncation -DSUPPORT_PLUGIN -DCONFIG_MSG_PUSH_POST_URL=/surveillance/v1/reportMsg -DCONFIG_NTP_HOSTNAME=n-tss.tplinkcloud.com.cn -DUP_FIRMWARE_LIMIT_SIZE=16777216 -DSENSITIVITY_INT -DMAKEROOM_BEFORE_UPGRADE -DAUDIO_ENABLE -DCONFIG_TP_TAPO_MAP_ROOTFS -DTP_VIGI -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/include -I/home/fuyu1/code/Platform_NVMP/nvmp/../sdk/soc/nvt9856x/uclibc-toolchain-1.0.32/arm-ca9-linux-uclibcgnueabihf-8.4.01/arm-ca9-linux-uclibcgnueabihf/sysroot/usr/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libiconv-full/include -I/home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/usr/lib/libintl-full/include -Wall -Werror -ffunction-sections -fdata-sections -DMODULE_LIST="\"tdpd tmpd mactool nifc ipcd dhcpc diagnose httpd tpntp system upgrade arp_scanner\"" -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/include -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/common/ds -I/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/mactool -I./libXml -I./libutils -I./libmediautil -c -o nsd.o nsd.c arm-ca9-linux-uclibcgnueabihf-ar build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/nsd.o "arm-ca9-linux-uclibcgnueabihf-ar crus -o nsd.a nsd.o" cp -f nsd.a libraries/ make[3]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd' touch /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/.built make V=ss -j1 clean-staging make[3]: Entering directory '/home/fuyu1/code/Platform_NVMP/nvmp/tp_package/nsd' rm -f /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/stamp/.nsd_installed make[3]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp/tp_package/nsd' rm -rf /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd mkdir -p /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/host /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/packages /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/host/packages # install -d -m0755 /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/usr/include/video_share # cp -fpR /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/modules/video_share/*.h /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/usr/include/video_share install -d -m0755 /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/usr/lib/nvmp/nsd cp -fpR /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/libraries/*.a /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/usr/lib/nvmp/nsd if [ -d /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd ]; then /bin/tar cf /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/nsd_pack.tar -C /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20 nsd/include nsd/libraries --exclude=out.* --exclude-vcs; /bin/tar rf /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/nsd_pack.tar -C /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20 nsd/common nsd/modules --exclude=*.o --exclude=*.c --exclude=*.a --exclude=Makefile --exclude-vcs; bzip2 /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/nsd_pack.tar -c > /home/fuyu1/code/Platform_NVMP/nvmp/bin/nvt9856x-cx20iv1.20/nsd_pack.tar.bz2; rm -f /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/nsd_pack.tar; fi install -d -m0755 /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/usr/lib/nvmp_files if [ -d /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/files/ ]; then cp -fpR /home/fuyu1/code/Platform_NVMP/nvmp/build_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/nsd/files/* /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/usr/lib/nvmp_files/; fi find /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd -name '*.la' | xargs -r rm -f; if [ -d /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd ]; then (cd /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd; find ./ > /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd.files); SHELL= /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/host/bin/flock /home/fuyu1/code/Platform_NVMP/nvmp/tmp/.staging-dir.flock -c ' mv /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd.files /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/packages/nsd.list && cp -fpR /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd/* /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/; '; fi rm -rf /home/fuyu1/code/Platform_NVMP/nvmp/tmp/stage-nsd touch /home/fuyu1/code/Platform_NVMP/nvmp/staging_dir/target-arm-ca9-linux-uclibcgnueabihf-cx20iv1.20/stamp/.nsd_installed make[2]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp/tp_package/nsd' make[1]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp' ERROR: please fix package/tp_package/wlan/Makefile - see logs/package/tp_package/wlan/dump.txt for details ERROR: please fix package/tp_package/ams_package/nvmp_algorithm/ams/Makefile - see logs/package/tp_package/ams_package/nvmp_algorithm/ams/dump.txt for details ERROR: please fix package/tp_package/ams_package/nvmp_algorithm/libdla/Makefile - see logs/package/tp_package/ams_package/nvmp_algorithm/libdla/dump.txt for details Collecting package info: done AMS: buildams.config and ams.config updated from ams source make[1]: Entering directory '/home/fuyu1/code/Platform_NVMP/nvmp' make[2]: Entering directory '/home/fuyu1/code/Platform_NVMP/nvmp/tp_package/nsd' make[2]: Nothing to be done for 'install'. make[2]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp/tp_package/nsd' make[1]: Leaving directory '/home/fuyu1/code/Platform_NVMP/nvmp'
09-08
SYSROOT=./sysroots/ CC := ./sysroots/x86_64-qtisdk-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-gcc --sysroot=$(SYSROOT) AR := ./sysroots/x86_64-qtisdk-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-ar #CC := /home6/weijianshe/zhanghong/LE.UM.7.4.1/build-qti-distro-tele-debug/tmp-glibc/work/sa525m-oe-linux/loc-api-wds/git-r1/recipe-sysroot-native/usr/bin/aarch64-oe-linux/aarch64-oe-linux-gcc --sysroot=$(SYSROOT) #AR := /home6/weijianshe/zhanghong/LE.UM.7.4.1/build-qti-distro-tele-debug/tmp-glibc/work/sa525m-oe-linux/loc-api-wds/git-r1/recipe-sysroot-native/usr/bin/aarch64-oe-linux/aarch64-oe-linux-ar #################################################################### #编译选项配置 CFLAGS +=-fPIC -DLINUX CFLAGS += -fstack-protector-all -Wl,-rpath=.,-z,now -O3 -Werror #CFLAGS += -I ../include/ #CFLAGS += -I ./sysroots/aarch64-oe-linux/usr/include/ #CFLAGS += -DHK_MEC_JETMON #-DMOGU_CHELIAN -DDESAYSV_CHANGAN CFLAGS = \ -I./sysroots/aarch64-oe-linux/usr/include \ -I./sysroots/aarch64-oe-linux/usr/include/c++/11.4.0 \ -I./sysroots/aarch64-oe-linux/usr/include/c++/11.4.0/aarch64-oe-linux #POR翻转 #CFLAGS += -DPOR_REVERSE LIB_PATH = -L./sysroots/aarch64-oe-linux/usr/lib -L./sysroots/aarch64-oe-linux/lib #延时方式,默认使用usleep, 可以通过SLEEP_SELECT或者SLEEP_CLOCK改变延时方式 CFLAGS += -DSLEEP_CLOCK #SPI通信方式,默认使用ioctl,SPI_IOCTL宏使用ioctl, 没定义SPI_IOCTL 使用read/write CFLAGS += -DSPI_IOCTL OBJS = $(SRCS:.c=.o) test: uarttest.o #$(CC) $(CFLAGS) -shared -o $@ exports $^ $(CC) $(CFLAGS) uarttest.c -o test -L./ -lpthread -lrt $(TARGET_A):$(OBJS) $(AR) -ruv $@ $^ %.o : %.c %.h $(CC) -c $(CFLAGS) $< clean: rm -f *.o $(TARGET_SO) $(TARGET_A) test 请优化下
08-02
[1/1] C:\Windows\system32\cmd.exe /C "cd /D D:\esp32_C3\internal_communication_client_0.2\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.2/build/bootloader/bootloader.bin" Bootloader binary size 0x5160 bytes. 0x2ea0 bytes (36%) free. [3/9] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/uart.c.obj FAILED: esp-idf/main/CMakeFiles/__idf_main.dir/uart.c.obj 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.2/build/config -ID:/esp32_C3/internal_communication_client_0.2/main -ID:/esp32_C3/internal_communication_client_0.2/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.2=. -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/uart.c.obj -MF esp-idf\main\CMakeFiles\__idf_main.dir\uart.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/uart.c.obj -c D:/esp32_C3/internal_communication_client_0.2/main/uart.c D:/esp32_C3/internal_communication_client_0.2/main/uart.c: In function 'uart_event_task': D:/esp32_C3/internal_communication_client_0.2/main/uart.c:41:50: error: 'counter' undeclared (first use in this function) 41 | sprintf(new_data, "New Data %d", counter); // 鍒涘缓鏂板唴瀛樼┖闂? | ^~~~~~~ D:/esp32_C3/internal_communication_client_0.2/main/uart.c:41:50: note: each undeclared identifier is reported only once for each function it appears in [4/9] Completed 'bootloader' ninja: build stopped: subcommand failed.
06-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值