使用了可变参数的宏定义 

编译器宏:__FUNCTION__,__FILE__,__LINE__

#define __debug

#ifdef __debug
  //#define debug(format,...) printf("File: "__FILE__"\nLine: %05d\nmessage: "format"\n", __LINE__, ##__VA_ARGS__)
  #define debug(format,...) printf("message: "format"\n", ##__VA_ARGS__)
#else
  #define debug(format,...)
#endif

 

 

 

最近由于希望使用IAR的printf()函数方便进行打印字符,出现IAR报错,即:identifier "FILE" is undefined,问题得以解决。

 

  (1)进行printf到串口的重映射:

  需添加头文件:#include "stdio.h"

  调试技巧 ------ printf 的使用技巧

 

 

 

 (2)经编译出现:

  调试技巧 ------ printf 的使用技巧

 

 

 

 (3)经查找原来是这里需要进行配置:

 调试技巧 ------ printf 的使用技巧

 

 

 

 (4)改成full就可以了:

 调试技巧 ------ printf 的使用技巧

 

相关文章:

  • 2021-06-01
  • 2022-12-23
  • 2021-11-02
  • 2021-08-17
  • 2021-05-16
  • 2021-08-28
  • 2021-09-22
  • 2021-08-14
猜你喜欢
  • 2021-04-25
  • 2022-12-23
  • 2022-02-08
  • 2021-12-04
相关资源
相似解决方案