Qt Creator autocomplete with cmake

In Qt Creator, I removed the qmake step and added my own cmake step with the CMakeLists.txt file. Now, for any classes I have defined internally in my project, autocomplete works. For example, the class names for my custom classes are displayed in a different color, and when I hover over a variable, it gives me detailed information about that variable.

However, for any third party libraries I use in my project, autocomplete does not work. Classes are displayed in standard white color and nothing appears when I hover over a variable from this library. But the libraries are correctly defined in CMakeLists.txt and my program compiles and works fine. Thus, Qt Creator can eventually find the libraries, but cannot do so while editing the code for the autocomplete to work. What solution?

+3


source to share


1 answer


You can try the following, it worked for me.

  • open the c ++ file where you want to auto-complete.
  • go to "tool -> C ++ -> check C ++ code model"
  • in the pop-up window, you will see the unresolved file under red under "snapshot" and documents and documents → "
  • manually locate the folder containing these files.
  • in the project view on the left is scanned, find the "[project name] .include" file
  • add to directories containing unresolved files and save you should now have automatic processing.


It seems to me that the qt-creators in the code model don't take the include path from cmake, but rely on the generated file.

0


source







All Articles