Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
Qt Creator 4.15.0, Qt Creator 4.15.1
-
None
-
-
4cad094066370fd177e3cb7fde64fd80e05eee84
Description
Suppose
- A Qt Creator project contains a header file and a source file including that header.
- The include path contains a symbolic link to the folder containing the header file.
- 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
- relates to
-
QTCREATORBUG-24609 CMake uses wrong header for switch header/source in not included subfolder
- Closed
-
QTCREATORBUG-23783 Follow symbol under cursor mismatch functions in different subprojects
- Closed