How to locate C/C++ macros?



  • Hi,

    I am using QT creator V2.7.1 in Kubuntu system and want to say I like Qt creator, it is great!

    In the 'Tools / locate ...' dialog (or input area), I can find several methods to locate C/C++ class or functions, but I cannot locate C/C++ macro there. In our C/C++ projects, there are lots of macro definitions, so it is important for us to locate them.

    Is there any configuration or plugin to fit this requirement? or will qt creator team consider to provide it in future?

    Thanks.



  • BTW, I tried sublime text, it is easy to locate symbols including macro, enum, union, and so on. But it is not a professional C/C++ IDE, so I think it could be great if qt creator can provide such 'locate symbol' functions.


  • Moderators

    Hi,

    Hover your mouse over the macro and press F2 (or right-click the macro and select "Follow Symbol Under Cursor"). The right-click menu also contains other nice shortcuts you might be interested in.



  • Well, that's not what I want. 'F2' is used to find the location of macro under cursor. I want to locate (or search) a macro/enum/union in the same way we locate a function.

    For example, the macro is 'INC_OPT_XXXXX', then in 'locate ...' area, we only need input ': INC_OPT', then IDE prompts all macros whose header is 'INC_OPT'. This is the exact way how qt creator find a function or class.


  • Moderators

    If I click on the magnifying glass on the left of the "locate" area, I get an option that says "Macros", along with "Classes", "Functions", etc.

    It doesn't seem to work for me though; might need a bug report.

    I'm using Qt Creator 2.8.2 on Windows 8.1 x64



  • Hi JKSH,

    I think such "Macros" in "locate ..." is Qt creator's macro, not C/C++ macros.


  • Moderators

    Ah, you're right.

    I'm not aware of a dedicated feature for macro searching in Qt Creator yet. You can submit a feature request at https://bugreports.qt-project.org/

    In the meantime, you can try using Ctrl+Shift+F to search for macros in your project.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.