When #defines are created using the project settings rather than in the source code, the syntax highlighter incorrectly dims sections between #ifdef / #endif blocks in header files.
For example, if I define DEBUG in the project settings and then have this in a header file:
// header.h#ifdef DEBUGvoid do_debug_thing(); // this line dimmed incorrectly#endif
// header.h
#ifdef DEBUG
void do_debug_thing(); // this line dimmed incorrectly
#endif
Does this make sense? I'm using the latest Keil V5 as of 18th January 2023.
Thanks,Charlie.
If the symbol is defined in the project settings then it works. To see the problem, use the Misc Controls section to include a header file automatically and then define symbols in that header file.
For example, create a file called header.h
#pragma once
#define TESTING
Then, in Misc Controls, add -include "header.h"
Then, in a C source file, try this
#if !defined(TESTING)
int test; // This line will be dimmed when it shouldn't be
still no problem on my side:
I haven't tried in 5.38, can't get free license to work with compiler V5