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: Using #define before #include does not work

Part Number: CODECOMPOSER


Tool/software:

Hi,

I'm trying to use the littlefs library.
Like many library, it can be configured with preprocessors. e.g. the LFS_NO_MALLOC will disable malloc.

Therefore, in my codebase, the before I include lfs.h, I define:

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

The problem is that it won't work.
In the following screenshot, you can clearly see the LFS_NO_MALLOC  having no effect.

Please note that this lfs.h is included only once.

I suspect the problem stems from the build system.

How can I make sure my #define affects #includes?

Regards,

Gabriel