2025-10-02 3:43 AM
I guess this is a GCC question, not specific to CubeIDE, but perhaps someone here knows?
Is there a way to make GCC report all the appearances of the undeclared identifier - not just the first?
I would find this more useful - rather than having to do a separate search to see if there are any other occurrences.
eg, It's not uncommon that I make the same spelling mistake in multiple places; or make a spelling mistake in the declaration, but spell all the references correctly; etc, ...
Googling hasn't helped me - it's just swamped by people explaining what "undeclared identifier" means.
I know what "undeclared identifier" means.
2025-10-02 3:55 AM
I suppose not, I am familiar with this error on (and for) every platform I used gcc lately.
Instead I usually rely on a decent editor that allows me to mark and replace all instances of a string in a file.
AFAIK the "refactor" functionality in Eclipse can do the same.
2025-10-02 4:02 AM
@Ozone wrote:I usually rely on a decent editor that allows me to...
But my point is that is (or may be) an unnecessary extra step.
I would like the compiler to show me all the occurrences - so that I can decide whether it warrants doing that.
@Ozone wrote:AFAIK the "refactor" functionality in Eclipse can do the same.
I find that is often the cause of these errors - the 'Refactor' didn't properly rename everything!
2025-10-02 4:04 AM
From what I know, GCC doesn’t have a built-in option to report every single occurrence of an undeclared identifier. It only flags the first one per function as a way to avoid flooding the compiler output.
A practical workaround is exactly what Ozone suggested: rely on IDE/editor tools. Most modern IDEs (including CubeIDE, Eclipse, or even VS Code) have search/replace or refactor features that can highlight all instances at once. This usually ends up being more efficient than waiting for the compiler to list every error.
2025-10-02 4:15 AM
You can dig into the toolchain's source code, if you like ...
2025-10-02 4:19 AM
I should add that it says "each undeclared identifier is reported only once" even when there is only one.