Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
Qt Creator 4.9.1
-
None
-
-
a8397c129f (qt-creator/qt-creator/master) a8397c129f (qt-creator/qt-creator/9.0)
Description
QtCreator doesn't consistently apply the Additional Preprocessor Directives (e.g. Tools -> C++ -> Additional Preprocessor Directives, or the `#` icon at the top of an editor window) when parsing a file. Sometimes the file is parsed as if the additional directives aren't present.
For example, if you have `#define FOO` in the additional preprocessor directives and your file has a `#ifdef FOO` section, sometimes that section will be greyed out and symbols defined in it won't be searchable.
One reliable way to trigger this problem is:
- Open a file with a `#ifdef FOO` section in the editor (can be any symbol, doesn't have to be `FOO` specifically).
- Add `#define FOO` to the Additional Preprocessor Symbols for the file, so that the ifdef'd section is not grayed out.
- Close and reopen QtCreator, then reopen your last session.
The ifdef'd section in the file is now grayed out, even though the `#define FOO` is still there in the additional preprocessor directives.
I sometimes see this happening simply while editing in QtCreator too, not just when I restart it. The problem occurs with both qmake and cmake projects.
Attachments
For Gerrit Dashboard: QTCREATORBUG-22584 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
433636,2 | CppEditor: Fix missing editor defines on session load | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |