This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TM4C123GH6PM:在调试/发布模式下、我如何在代码中设置一个 define 来标记它。

Guru**** 2024750 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1417866/tm4c123gh6pm-when-in-debug-release-mode-how-can-i-set-a-define-in-my-code-to-flag-it

器件型号:TM4C123GH6PM

工具与软件:

您好!

我有如下代码:

#ifdef 调试
   char loginfo_buffer[128];
#endif

但我现在要使用 CCS 中的调试配置来打开和关闭它。 调试配置是否向代码添加了任何标志、或者如何使代码知道是否在调试配置中。

此致、

CAN

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 CAN、

     在 CCS 中、有两种默认配置:Debug 和 Release。  

    对于调试配置、您可以将调试符号添加到"Predefined Symbols"选项卡。 这样做将使您的调试配置包含  loginfo_buffer[128]的代码和包含#ifdef debug 的代码。 对于 Release 配置、您不必添加调试符号、并且 Release 编译将不会包含用于调试的代码。