Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 4.9.0-beta1
-
None
-
2c5808bada8cbca42131e63495f4dd251b36acfb (qt-creator/qt-creator/master)
Description
Source code project:
File | Content |
---|---|
A.cpp | #include "A.h" void A::Hey() { } int main() {} |
myincludes/A.h |
class A { void Hey(); }; |
compile_commands.json | [ { "arguments": [ "/usr/bin/g++", "-c", "-I", "myincludes", "A.cpp" ], "directory": "/bugs", "file": "A.cpp" } ] |
Reproduction:
0. Install Bear.
1. With above sources, bear g++ -I myincludes A.cpp
2. Enable the plugin CompilationDatabaseProjectManager.
3. Open compile_commands.json (shown above for completeness).
4. CTRL+K and open A.cpp.
5. Tools -> C++ -> Switch Header/Source
Actual:
Nothing happens.
Expected:
A.h opens up.
Note:
To always hit the right header file, we will need to search header dirs in GCC/Clang's order, see lookup order in GCC's manual. For instance, if A.h is found in both . and -I myincludes then ./A.h should be picked up.
Attachments
For Gerrit Dashboard: QTCREATORBUG-22031 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
254354,2 | CompilationDatabase: Match source files with .h-files | master | qt-creator/qt-creator | Status: NEW | 0 | 0 |