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

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • Qt Creator 6.0.0
    • Qt Creator 4.15.0, Qt Creator 4.15.1
    • C/C++/Obj-C++ Support
    • None
    • Linux/X11
    • 4cad094066370fd177e3cb7fde64fd80e05eee84

    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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes