Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-25803

"This file is not part of any project" warning shown for headers included via paths with symbolic links

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: Qt Creator 4.15.0, Qt Creator 4.15.1
    • Fix Version/s: None
    • Component/s: C/C++/Obj-C++ Support
    • Labels:
      None
    • Platform/s:
      Linux/X11

      Description

      Suppose

      1. A Qt Creator project contains a header file and a source file including that header.
      2. The include path contains a symbolic link to the folder containing the header file.
      3. The header file is opened by double-clicking its name in the Projects view.

      Then Qt Creator displays the warning

      This file is not part of any project. The code model might have issues parsing this file properly.

      at the top of the editor window. This does not happen if the header file is opened by right-clicking the #include directive in the source file and selecting Follow Symbol Under Cursor from the context menu.

      In practice, this problem can occur for example if the build system is configured to create a symbolic link within the build folder pointing to the source folder or its subdirectory and to add a folder containing this symbolic link to the include path. I attach an example CMake project that does that.

      As I understand it, Qt Creator determines whether a header file is part of the project by using the DependencyTable class to check if this file is included by any file known to belong to the project. However, files are identified by a direct comparison of paths obtained by the include resolution process with paths to project files; to handle symbolic links correctly, these paths would need to be brought first to the canonical form. I'm going to submit a patch modifying the DependencyTable class in this way.

        Attachments

          Issue Links

          For Gerrit Dashboard: QTCREATORBUG-25803
          # Subject Branch Project Status CR V

            Activity

              People

              Assignee:
              kandeler Christian Kandeler
              Reporter:
              puddleglum Wojciech Smigaj
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There is 1 open Gerrit change