Priority: Not Evaluated
Affects Version/s: Qt Creator 4.15.0, Qt Creator 4.15.1
Fix Version/s: None
Component/s: C/C++/Obj-C++ Support
- 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.
|For Gerrit Dashboard: QTCREATORBUG-25803|
|351917,1||DependencyTable: Resolve symbolic links before comparing paths||master||qt-creator/qt-creator||Status: NEW||0||0|