I know, there is a lot of similar questions, but solutions from existing threads don't help me.
I have installed QT6.2.2 (official installer) on MacOS 12.0.1. Project (cmake) opens and builds fine in QTCreator. In VSCode project builds and intellisense mostly works fine, except for this includes (with QtWidgets, QtCore, etc. prefixes):
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qcoreapplication.h>
#include <QtGui/qwindowdefs.h>
Errors like this:
cannot open source file "QtGui/qwindowdefs.h" C/C (1696)
This is in settings.json:
"cmake.configureArgs": [
"-DCMAKE_PREFIX_PATH:STRING=/Users/nshibalov/Qt/6.2.2/macos"
],
c_cpp_properties.json:
{
"configurations": [
{
"name": "Mac",
"macFrameworkPath": [
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks",
"/Users/nshibalov/Qt/6.2.2/macos/lib"
],
"compilerPath": "/usr/bin/clang ",
"cStandard": "c17",
"cppStandard": "c 17",
"intelliSenseMode": "macos-clang-x64",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
I have tried alot solutions with configurationProvider and mergeConfigurations params, tried to add all include paths from compile_commands.json to includePath (recursive and not) without success.
I'm new to MacOS world and there is a guess that this somehow connected to Frameworks.
I really hope for your help.
CodePudding user response:
After many tryies (with clean project), I have figured out that problem occures when I add add_subdirecory
command to the CMakeLists.txt. For now I stick to the idea that problem is bound to this issue https://github.com/microsoft/vscode-cmake-tools/issues/1596 (though, I don't use configurationProvider).
P.S.: project I try to add is xlnt (https://github.com/tfussell/xlnt).
CodePudding user response:
I made a clean project, transferred the project files there and now everything works as it should. Probably the problem was in some settings of the project, but I could not find in which ones. Sorry for disturbing.