I have MSYS2 on my Windows PC and have added configuration to c_cpp_properties,json to allow IntelliSense to know about it. However, whenever I start VS Code the selected configuration is always set back to Win32. Is there some way I can tell cpp tools that this folder uses a different configuration? (MinGW64 in this case) while still keeping Win32 available to be selected?
This is my additions to the c_cpp_properties.json configurations:
{
"name": "Win32",
"includePath": [
"${workspaceRoot}"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "MinGW64",
"intelliSenseMode": "clang-x64",
"includePath": [
"${workspaceRoot}",
"C:/msys64/mingw64/include/c++/7.3.0",
"C:/msys64/mingw64/include/c++/7.3.0/x86_64-w64-mingw32",
"C:/msys64/mingw64/include/c++/7.3.0/backward",
"C:/msys64/mingw64/include",
"C:/msys64/mingw64/x86_64-w64-mingw32/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"__GNUC__=6",
"__cdecl=__attribute__((__cdecl__))"
],
"browse": {
"path": [
"C:/msys64/mingw64/include",
"C:/msys64/mingw64/x86_64-w64-mingw32/include",
"C:/msys64/mingw64/x86_64-w64-mingw32/include/*"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
That sounds like a bug. We don't have a way to set a "default" configuration right now, but we should be saving the active configuration when you close VSCode so that you can start where you left off the next time you open the folder. Do you use a multi-root workspace?
Hi @bobbrow, no, I am seeing this with a single-root workspace. I can do some more experimenting with the nature of this tomorrow now I know there is supposed to be active config recall.
I've thrown together a very basic C++ program in a new directory, with the following c_cpp_properties.json. If I select the MinGW64 configuration, the green squiggles in the includes go away. If I then close and immediately reopen vscode it shows Win32 as the selected configuration, the green squiggles are back and I get a prompt to configure includePath for better IntelliSense results.
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
]
},
{
"name": "Linux",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Win32",
"includePath": [
"${workspaceRoot}"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "MinGW64",
"intelliSenseMode": "clang-x64",
"includePath": [
"${workspaceRoot}",
"C:/msys64/mingw64/include/c++/7.3.0",
"C:/msys64/mingw64/include/c++/7.3.0/x86_64-w64-mingw32",
"C:/msys64/mingw64/include/c++/7.3.0/backward",
"C:/msys64/mingw64/include",
"C:/msys64/mingw64/x86_64-w64-mingw32/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"__GNUC__=6",
"__cdecl=__attribute__((__cdecl__))"
],
"browse": {
"path": [
"C:/msys64/mingw64/include",
"C:/msys64/mingw64/x86_64-w64-mingw32/include",
"C:/msys64/mingw64/x86_64-w64-mingw32/include/*"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 3
}
Thanks for reporting this -- we're able to repro the bug. It's resetting to the OS default if there are 3 or more configs. You can work around this by deleting one of the unused configs.
This is fixed in 0.17.0.
Most helpful comment
This is fixed in 0.17.0.