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.

[参考译文] CODECOMPOSER:在#include 之前使用#define 不起作用

Guru**** 2577385 points


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

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1573071/codecomposer-using-define-before-include-does-not-work

部件号:CODECOMPOSER


工具/软件:

您好、

我尝试使用 littlefs 库。
与许多库一样、可以使用前置处理器对其进行配置。 例如、 Lfs_no_malloc 将禁用 malloc。

因此、在我的代码库中、 在包括 Lfs.h 之前、我定义了:

#define LFS_NO_MALLOC
#include "littlefs/lfs.h"

问题是它不起作用。
在下面的屏幕截图中、您可以清楚地看到  Lfs_no_malloc 无效。

请注意、此 lfs.h 仅包含一次。

我怀疑问题是由构建系统引起的。

如何确保#define 影响#include?

此致、

Gabriel