Skip to main content
t_j_l
Associate II
December 9, 2025
Question

sometimes some unnecessary #include statements automatically added.

  • December 9, 2025
  • 1 reply
  • 1305 views

When writing code, it is common to encounter the automatic inclusion of some unnecessary #include statements. For example, when I input "NULL" and press the Enter key, it will automatically add " #include <cstddef> ".5d4efb0c-42c5-4875-87f1-2af14162023c.png9e383e1b-8f6b-416c-b886-7a4e14d63698.png

1 reply

TDK
December 10, 2025

This is hard to follow. Where are you inputting NULL? Is this an autocomplete thing?

the IDE shows the file has been modified, but changing the file outside of user code blocks shouldn’t be done.

"If you feel a post has answered your question, please click ""Accept as Solution""."
t_j_l
t_j_lAuthor
Associate II
December 10, 2025

I entered "uint32_t *pi = NULL" in the user code section. When I pressed the Enter key while the code for handling the NULL input was being displayed, it automatically added "#include"

t_j_l
t_j_lAuthor
Associate II
December 10, 2025

I think this is unreasonable. Firstly, if it is to be automatically added, it should be added to the user code area instead of the current location (because this would be overwritten when generating the code using STM32CubeMX). Secondly, the automatically added "#include <cstddef>" is also incorrect and cannot be compiled. It should be "#include <stddef.h>".