Visual Studio Code gets the following error:
cannot open source file "QtWidgets/qtwidgetsglobal.h" (dependency of "QApplication")C/C++(1696)
I have a CMake project which compiled and built successfully, but it seems that Intellisense doesn't work.
I have this directory in a path which contains qtwidgetsglobal.h
:
/usr/local/Cellar/qt/5.13.1/lib/QtWidgets.framework/Headers
And there is another thing:
Directory /usr/local/Cellar/qt/5.13.1/lib/QtWidgets.framework
contains directory Headers
and strange executable QtWidgets
I was assumed to include -I/usr/local/Cellar/qt/5.13.1/lib/QtWidgets.framework
because QtCreator has both
/usr/local/Cellar/qt/5.13.1/lib/QtWidgets.framework
and
/usr/local/Cellar/qt/5.13.1/lib/QtWidgets.framework/Headers
but nothing worked.
Actually Visual Studio Code seems to ignore if both directories
/usr/local/Cellar/qt/5.13.1/lib/QtWidgets.framework
and
/usr/local/Cellar/qt/5.13.1/lib/QtWidgets.framework/Headers
specified.
Any suggestions how to enable Intellisense to work with Visual Studio Code.
You need to use the compileCommands instead of the cake-tools configurationProvider.
Therefore in your c_cpp_properties.json
add the line
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
and remove
"configurationProvider": "ms-vscode.cmake-tools",
The full config file should look something like this
{
"configurations": [
{
"name": "Mac",
"compilerPath": "/usr/bin/clang",
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
"browse": {
"limitSymbolsToIncludedHeaders": true
},
"macFrameworkPath": [
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"cStandard": "c11",
"intelliSenseMode": "clang-x64",
"cppStandard": "c++14"
}
],
"version": 4
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With