"Multiple parse contexts" in Qt creator


  • Moderators

    Not sure what is meant here:
    0_1503840310552_c66c496e-3d80-4907-ae00-715afbba0d87-image.png

    This comes from Qt creator latest version 4.3.1 on windows 10,in case it matters.

    I am at a loss what I can do to get rid of it. Obviously, I can use "Do Not Show Again" which is on the right of the message, but I prefer to know, what I am ignoring.

    What are possible causes?



  • Most likely you have multiple (Sub-)projects containg this file. Depending on the parse context, different defines may be active that influence the parsing of this file


  • Qt Champions 2016

    Hi
    Do you use sessions?
    https://bugreports.qt.io/browse/QTCREATORBUG-18521

    Anyway, its not clear from source what is being checked

    CppTools::BaseEditorDocumentProcessor *CppEditorDocument::processor()
    {
      ...
                const bool isAmbiguous = info.hints & ProjectPartInfo::IsAmbiguousMatch;
                const bool isProjectFile = info.hints & ProjectPartInfo::IsFromProjectMatch;
                showHideInfoBarAboutMultipleParseContexts(isAmbiguous && isProjectFile); // this shows msg
    

    The IsFromProjectMatch flag is set here
    cppprojectpartchooser.cpp

            // Hints
            if (m_info.projectParts.size() > 1)
                m_info.hints |= ProjectPartInfo::IsAmbiguousMatch;
            if (prioritized.first().priority > 1000)
                m_info.hints |= ProjectPartInfo::IsPreferredMatch;
            if (areProjectPartsFromDependencies)
                m_info.hints |= ProjectPartInfo::IsFromDependenciesMatch;
            else
                m_info.hints |= ProjectPartInfo::IsFromProjectMatch;
    

    so it seems to be related to sort / classify files depending on origin but didnt really see the meaning of
    multiple contexts.

    update: yep, as @aha_1980 says, sub projects might trigger this , it seems from the code.

    [Added code tags ~kshegunov]


  • Moderators

    Thanks guys.

    Yes, I am using subprojects.
    Yes, I am using sessions.

    Within the session I have/had a couple of projects which I have also put into a subdirs project,which is also open.

    Apparently the message is an one time display, because it does not vanish after:

    • closing the duplicates
    • changing to another file

    I was using a search over all projects with some text. That might have triggered the message.
    I guess for the first time, it might make sense for a file. However, when switching to another file, the meaning is lost, because the message refers to "this file".

    The description of the bug report does not really fit my case.

    How can I choose a prefered one then?



  • you can select the active parse context with drop down box (3) from http://doc.qt.io/qtcreator/creator-coding-navigating.html


  • Moderators

    @aha_1980

    Thanks for link. That is exactly what I was looking for.

    As a side note, the dropdown box is not always visible. I had realized that there was something, but could not really make it out. In addition the content was not obviously related to my issue. Probably, I have seen the box the first time in that context.
    IMHO the warning text is ambigious, which causes confusion. However, rather than just complaining about it, which is always easy, I cannot offer an alternative text.


Log in to reply
 

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