使用 printf 冻结 MPLAB X 构建

MPLAB X freeze building using printf

我的设置是:

当我尝试使用 printf 时出现了 Mi 问题。我可以打印字符串但不能打印变量。

此行已正确编译:

printf("HI");

此行构建不正确:

unsigned int var;
var = 1; 
printf("%u", var);

相同的代码与其他 PIC (PIC24FJ512GA606) 和编译器 (XC16) 完美配合。 在这两个项目中,我们都使用来自同一个库的 printf stdio.h

当我尝试构建项目时出现问题。如果我使用 "printf("%u", var);"并构建它,IDE 挂起,我必须取消构建过程。之后我无法清理项目,IDE 显示下一个文本:

rm: no se puede borrar build/SF_Utility_v31_RS485/production/interrupts_remapped.o: Permission denied
rm: no se puede borrar build/SF_Utility_v31_RS485/production/mult.o: Permission denied
rm: no se puede borrar build/SF_Utility_v31_RS485/production/SF_debug.o: Permission denied
rm: no se puede borrar build/SF_Utility_v31_RS485/production/SF_formatter.o: Permission denied
rm: no se puede borrar build/SF_Utility_v31_RS485/production/SF_HAL_axis_references.o: Permission denied
rm: no se puede borrar build/SF_Utility_v31_RS485/production/SF_internal_comms.o: Permission denied

CLEAN FAILED (exit value 1, total time: 123ms)

如果我转到文件夹并尝试手动删除,会出现一条消息说我无法删除它,因为“pic30-elf-gcc.exe”正在使用它。我必须关闭进程,然后您可以使用“printf("Hi");”清理并重建项目...

EDIT1:当我构建项目时,我可以观察到每个文件都已正确编译。链接器出现问题...当我尝试构建项目时,它在下一行挂起:

"C:\Program Files (x86)\Microchip\MPLAB C30\bin\pic30-gcc.exe"   -omf=elf -mcpu=24FJ128GA306  -o dist/SF_Utility_v31_RS485/production/sf-device.production.elf build/SF_Utility_v31_RS485/production/DEE_Emulation/DEE_Emulation_16-bit_v2.2/DEE_Emulation_16-bit/DEE_Emulation_16-bit.o build/SF_Utility_v31_RS485/production/DEE_Emulation/DEE_Emulation_16-bit_v2.2/DEE_Emulation_16-bit/Flash_Operations.o build/SF_Utility_v31_RS485/production/RS485/SF_RS485.o build/SF_Utility_v31_RS485/production/src/ADC_Handler/ADC_Handler.o build/SF_Utility_v31_RS485/production/src/Event_Timer/osal_timers.o build/SF_Utility_v31_RS485/production/src/PWM/PWM_Core_Handler.o build/SF_Utility_v31_RS485/production/src/PWM/PWM_Func_Layer.o build/SF_Utility_v31_RS485/production/src/PWM/PWM_Hal_Layer.o build/SF_Utility_v31_RS485/production/HTS221.o build/SF_Utility_v31_RS485/production/LISXDH.o build/SF_Utility_v31_RS485/production/src/Tasks/LED_Status_Task.o build/SF_Utility_v31_RS485/production/src/Tasks/System_Task_Handler.o build/SF_Utility_v31_RS485/production/src/Tasks/Hum_Temp_Task.o build/SF_Utility_v31_RS485/production/configuration_bits.o build/SF_Utility_v31_RS485/production/main.o build/SF_Utility_v31_RS485/production/system.o build/SF_Utility_v31_RS485/production/traps.o build/SF_Utility_v31_RS485/production/user.o build/SF_Utility_v31_RS485/production/SF_controller.o build/SF_Utility_v31_RS485/production/SF_solar_calculations.o build/SF_Utility_v31_RS485/production/SF_solar_calculations_utils.o build/SF_Utility_v31_RS485/production/SF_time.o build/SF_Utility_v31_RS485/production/SF_tracker.o build/SF_Utility_v31_RS485/production/SF_settings.o build/SF_Utility_v31_RS485/production/SF_protocol.o build/SF_Utility_v31_RS485/production/SF_io_manager.o build/SF_Utility_v31_RS485/production/SF_inverter.o build/SF_Utility_v31_RS485/production/utils.o build/SF_Utility_v31_RS485/production/SF_main_loop.o build/SF_Utility_v31_RS485/production/SF_persistence.o build/SF_Utility_v31_RS485/production/SF_formatter_binary.o build/SF_Utility_v31_RS485/production/SF_GW_Common.o build/SF_Utility_v31_RS485/production/SF_tick.o build/SF_Utility_v31_RS485/production/mult.o build/SF_Utility_v31_RS485/production/SF_internal_comms.o build/SF_Utility_v31_RS485/production/interrupts_remapped.o build/SF_Utility_v31_RS485/production/SF_formatter.o build/SF_Utility_v31_RS485/production/SF_HAL_axis_references.o build/SF_Utility_v31_RS485/production/SF_debug.o        -legacy-libc -Wl,--defsym=__MPLAB_BUILD=1,--heap=1024,-Map="prueba.map",-Tp24FJ128GA306.gld

我有办法。问题是我的项目有旧库处于活动状态...在项目配置中取消选中该选项现在 运行 正确。