How use Qt in Visual Studio Code?
Solution 1
You should give a chance for this extension: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
With this, you can configure include paths for better IntelliSense results.
Configuring includePath
One way to configure e.g the QtCore module.
- Ctrl + Shift + p to open command palette
- Search for:
C/Cpp: Edit Configurations
- You should have a new tab called:
c_cpp_properties.json
- In
configurations
array you should edit the Linux section - Add your paths in the
includePath
setting e.g:/usr/include/x86_64-linux-gnu/qt5/QtCore
For more check this: https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/Getting%20started.md
IntelliSense engines
We recommend using the "Default" engine for the best IntelliSense experience. However, it is possible to explicitly choose the IntelliSense engine by editing your user or workspace settings. The setting you should modify is C_Cpp.intelliSenseEngine
-
Default
- Visual Studio's IntelliSense engine, which is the default engine that provides semantic-aware IntelliSense features -
Tag Parser
- the "fuzzy" IntelliSense engine that provides quick but "fuzzy" results, is used to provide the fallback experience if the default engine is
More details about it: https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/IntelliSense%20engine.md
Solution 2
The methods for adding Qt headers to the cpptools
extension have changed since the last answer. Options for doing so now include:
Automatically adding a found Qt header path by clicking on the light bulb above an IntelliSense error and selecting
Add to "includePaths"...
Manually adding the Qt header paths to the settings UI, from the command palette, via
C/Cpp: Edit Configurations (UI)
Manually adding the Qt header paths to the settings JSON file, from the command palette, via
C/Cpp: Edit Configurations (JSON)
More info in this page of the new documentation.
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on February 17, 2022Comments
-
Admin over 2 years
How do I use Qt in Visual Stuidio Code operating system Linux Mint 18?
Marketplace doesnt exist extension for Qt. Maybe anyone knows more!
UPD. I meant that by type Qt AddIn
-
QuesterDesura about 5 yearsFor me the path was: /opt/Qt/5.13.0/gcc_64/include/**
-
F. Norbert about 5 yearsYes, if you installed Qt via the provided GUI based installer the install path will be the /opt/ one AFAIK.
-
Alexander Yammine over 4 yearsMy path was: /usr/include/qt4/**