vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

command-line error: language modes specified are incompatible

Open PoignardAzur opened this issue 1 year ago • 12 comments

Environment

  • OS and Version: Pop!_OS 22.04 LTS
  • VS Code Version: 1.68.1
  • C/C++ Extension Version: v1.11.4
  • Other extensions: C/C++ Extension pack (disabling other extensions doesn't seem to matter)

Bug Summary and Steps to Reproduce

Bug Summary: When opening any .c file in my project, VSCode displays a single error at the top of the file:

command-line error: language modes specified are incompatible

This is extremely unhelpful: the error message doesn't include what these "language modes" are, where they're declared, what they current values are, or why these values are "incompatible".

Steps to reproduce:

  • Unknown.

Expected behavior

I expect IDE errors to point to the configuration file that is causing the error and explain why the configuration is invalid.

Failing that, I expect the error message to print out the incorrect value so that I can grep the configuration files myself.

(Note: looking for the error message on Google points me to other Github issues with similar problems. Each of these issues has been closed after the poster solved their problem, but none of them actually explain what the problem is or what the error message means, or at least not in a way relevant beyond their specific workflow.)

Code sample and Logs

-------- Diagnostics - 8/4/2022, 4:15:20 PM
Version: 1.11.4
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "${workspaceFolder}/**",
        "/home/olivier-faure/Documents/emsdk/upstream/emscripten/system/include/"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/clang",
    "cStandard": "c99",
    "cppStandard": "c++14",
    "intelliSenseMode": "linux-clang-x64",
    "mergeConfigurations": false,
    "configurationProvider": "ms-vscode.makefile-tools",
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    },
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true
}
Custom browse configuration: 
{
    "browsePath": [
        "/home/olivier-faure/Documents/mupdf/include",
        "/home/olivier-faure/Documents/mupdf/include/mupdf",
        "/home/olivier-faure/Documents/mupdf/platform/gl",
        "/home/olivier-faure/Documents/mupdf/platform/x11",
        "/home/olivier-faure/Documents/mupdf/scripts/freetype",
        "/home/olivier-faure/Documents/mupdf/scripts/libjpeg",
        "/home/olivier-faure/Documents/mupdf/source/cbz",
        "/home/olivier-faure/Documents/mupdf/source/fitz",
        "/home/olivier-faure/Documents/mupdf/source/helpers/mu-threads",
        "/home/olivier-faure/Documents/mupdf/source/helpers/pkcs7",
        "/home/olivier-faure/Documents/mupdf/source/html",
        "/home/olivier-faure/Documents/mupdf/source/pdf",
        "/home/olivier-faure/Documents/mupdf/source/reflow",
        "/home/olivier-faure/Documents/mupdf/source/svg",
        "/home/olivier-faure/Documents/mupdf/source/tools",
        "/home/olivier-faure/Documents/mupdf/source/xps",
        "/home/olivier-faure/Documents/mupdf/thirdparty/extract/include",
        "/home/olivier-faure/Documents/mupdf/thirdparty/extract/src",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freeglut/include",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freeglut/src",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freeglut/src/x11",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freetype/include",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freetype/src/base",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freetype/src/cff",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freetype/src/cid",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freetype/src/psaux",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freetype/src/pshinter",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freetype/src/psnames",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freetype/src/raster",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freetype/src/sfnt",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freetype/src/smooth",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freetype/src/truetype",
        "/home/olivier-faure/Documents/mupdf/thirdparty/freetype/src/type1",
        "/home/olivier-faure/Documents/mupdf/thirdparty/gumbo-parser/src",
        "/home/olivier-faure/Documents/mupdf/thirdparty/harfbuzz/src",
        "/home/olivier-faure/Documents/mupdf/thirdparty/jbig2dec",
        "/home/olivier-faure/Documents/mupdf/thirdparty/lcms2/include",
        "/home/olivier-faure/Documents/mupdf/thirdparty/lcms2/src",
        "/home/olivier-faure/Documents/mupdf/thirdparty/libjpeg",
        "/home/olivier-faure/Documents/mupdf/thirdparty/mujs",
        "/home/olivier-faure/Documents/mupdf/thirdparty/openjpeg/src/lib/openjp2",
        "/home/olivier-faure/Documents/mupdf/thirdparty/zlib"
    ],
    "compilerPath": "/usr/bin/cc",
    "windowsSdkVersion": "",
    "compilerArgsLegacy": []
}
Translation Unit Mappings:
[ /home/olivier-faure/Documents/mupdf/platform/wasm/lib/wrap.c ]:
    /home/olivier-faure/Documents/mupdf/platform/wasm/lib/wrap.c
[ /home/olivier-faure/Documents/mupdf/source/fitz/document.c ]:
    /home/olivier-faure/Documents/mupdf/source/fitz/document.c
Translation Unit Configurations:
[ /home/olivier-faure/Documents/mupdf/platform/wasm/lib/wrap.c ]:
    Process ID: 27372
    Memory Usage: 84 MB
    Compiler Path: /usr/bin/cc
    Includes:
        /usr/include/c++/11
        /usr/include/x86_64-linux-gnu/c++/11
        /usr/include/c++/11/backward
        /usr/lib/gcc/x86_64-linux-gnu/11/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c17
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=110200
[ /home/olivier-faure/Documents/mupdf/source/fitz/document.c ]:
    Process ID: 27688
    Memory Usage: 84 MB
    Compiler Path: /usr/bin/cc
    Includes:
        /usr/include/c++/11
        /usr/include/x86_64-linux-gnu/c++/11
        /usr/include/c++/11/backward
        /usr/lib/gcc/x86_64-linux-gnu/11/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c17
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=110200
Total Memory Usage: 169 MB

PoignardAzur avatar Aug 04 '22 14:08 PoignardAzur

Can you try 1.12.0 (pre-release)? This sounds like fixed bug https://github.com/microsoft/vscode-cpptools/issues/9628 .

sean-mcmanus avatar Aug 04 '22 18:08 sean-mcmanus

Can you try 1.12.0 (pre-release)? This sounds like fixed bug #9628 .

I still have this issue. my c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\msys64\\mingw64\\bin\\gcc.exe",
            "intelliSenseMode": "windows-gcc-x64",
            "configurationProvider": "ms-vscode.cmake-tools"
        }
    ],
    "version": 4
}

it shows this error image in every .c file opened

Jai-JAP avatar Aug 05 '22 07:08 Jai-JAP

@Jai-JAP Your repro details are different from the original reporters. Can you provider the output of running C/C++: Log Diagnostics? We need info on how CMake is being configured and what std version info it is sending us.

sean-mcmanus avatar Aug 05 '22 17:08 sean-mcmanus

@sean-mcmanus

loggingLevel: Debug
Custom browse configuration received: {
  "browsePath": [
    "d:/pc data/desktop/******/build",
    "d:/pc data/desktop/******"
  ],
  "compilerPath": "c:/msys64/mingw64/bin/gcc.exe",
  "compilerArgs": [],
  "compilerFragments": [
    "-g",
    "-std=gnu11"
  ]
}
cpptools/didChangeCppProperties
Custom configuration provider 'CMake Tools' registered
Custom browse configuration received: {
  "browsePath": [
    "d:/pc data/desktop/******/build",
    "d:/pc data/desktop/******"
  ],
  "compilerPath": "c:/msys64/mingw64/bin/gcc.exe",
  "compilerArgs": [],
  "compilerFragments": [
    "-g",
    "-std=gnu11"
  ]
}
Code browsing service initialized
Attempting to get defaults from C++ compiler in "compilerPath" property: 'C:\msys64\mingw64\bin\gcc.exe'
Compiler query command line: C:\msys64\mingw64\bin\gcc.exe -std=gnu++11 -m64 -Wp,-v -E -dM -x c++ nul
Attempting to get defaults from C compiler in "compilerPath" property: 'C:\msys64\mingw64\bin\gcc.exe'
Compiler query command line: C:\msys64\mingw64\bin\gcc.exe -std=gnu11 -m64 -Wp,-v -E -dM -x c nul
Custom browse configuration received: {
  "browsePath": [
    "d:/pc data/desktop/******/build",
    "d:/pc data/desktop/******"
  ],
  "compilerPath": "c:/msys64/mingw64/bin/gcc.exe",
  "compilerArgs": [],
  "compilerFragments": [
    "-g",
    "-std=gnu11"
  ]
}
  Folder: C:/MSYS64/MINGW64/INCLUDE/ will be indexed
  Folder: C:/MSYS64/MINGW64/LIB/GCC/X86_64-W64-MINGW32/12.1.0/INCLUDE/ will be indexed
  Folder: C:/MSYS64/MINGW64/LIB/GCC/X86_64-W64-MINGW32/12.1.0/INCLUDE-FIXED/ will be indexed
  Folder: D:/PC DATA/DESKTOP/******/ will be indexed
cpptools/didChangeCustomBrowseConfiguration
Attempting to get defaults from C++ compiler in "compilerPath" property: 'c:/msys64/mingw64/bin/gcc.exe'
Querying compiler for default C++ language standard using command line: c:/msys64/mingw64/bin/gcc.exe -x c++ -E -dM nul
Detected language standard version: gnu++17
Querying compiler for default C language standard using command line: c:/msys64/mingw64/bin/gcc.exe -x c -E -dM nul
Custom browse configuration received: {
  "browsePath": [
    "d:/pc data/desktop/******/build",
    "d:/pc data/desktop/******"
  ],
  "compilerPath": "c:/msys64/mingw64/bin/gcc.exe",
  "compilerArgs": [],
  "compilerFragments": [
    "-g",
    "-std=gnu11"
  ]
}
Detected language standard version: gnu17
Querying compiler's default target using command line: "c:/msys64/mingw64/bin/gcc.exe" -dumpmachine
Compiler returned default target value: x86_64-w64-mingw32
Compiler query command line: c:/msys64/mingw64/bin/gcc.exe -g -std=c++17 -m64 -Wp,-v -E -dM -x c++ nul
  Folder: C:/MSYS64/MINGW64/LIB/GCC/X86_64-W64-MINGW32/12.1.0/INCLUDE/ will be indexed
  Folder: C:/MSYS64/MINGW64/INCLUDE/ will be indexed
  Folder: C:/MSYS64/MINGW64/LIB/GCC/X86_64-W64-MINGW32/12.1.0/INCLUDE-FIXED/ will be indexed
  Folder: D:/PC DATA/DESKTOP/******/ will be indexed
cpptools/clearCustomConfigurations
cpptools/didChangeCppProperties
cpptools/pauseParsing
cpptools/clearCustomConfigurations
cpptools/didChangeCustomBrowseConfiguration
Attempting to get defaults from C++ compiler in "compilerPath" property: 'c:/msys64/mingw64/bin/gcc.exe'
cpptools/resumeParsing
cpptools/clearCustomConfigurations
cpptools/didChangeCustomBrowseConfiguration
Attempting to get defaults from C++ compiler in "compilerPath" property: 'c:/msys64/mingw64/bin/gcc.exe'
cpptools/resumeParsing
cpptools/clearCustomConfigurations
cpptools/didChangeCustomBrowseConfiguration
Attempting to get defaults from C++ compiler in "compilerPath" property: 'c:/msys64/mingw64/bin/gcc.exe'
cpptools/resumeParsing
Discovering files...
  Processing folder (recursive): C:/MSYS64/MINGW64/LIB/GCC/X86_64-W64-MINGW32/12.1.0/INCLUDE/
  Processing folder (recursive): C:/MSYS64/MINGW64/INCLUDE/
  Processing folder (recursive): C:/MSYS64/MINGW64/LIB/GCC/X86_64-W64-MINGW32/12.1.0/INCLUDE-FIXED/
  Processing folder (recursive): D:/PC DATA/DESKTOP/******/
  Discovering files: 3534 file(s) processed
  0 file(s) removed from database
Done discovering files.
Populating include completion cache.
Parsing remaining files...
  Parsing: 0 files(s) processed
Done parsing remaining files.

i have replaced my project name with ******

Jai-JAP avatar Aug 06 '22 05:08 Jai-JAP

Can you try 1.12.0 (pre-release)? This sounds like fixed bug https://github.com/microsoft/vscode-cpptools/issues/9628 .

You're missing the point, though.

The underlying problem is that the language server fails with a message that gives no information about the failure's cause whatsoever.

PoignardAzur avatar Aug 06 '22 15:08 PoignardAzur

@Jai-JAP You provided the C/C++ logging -- can you also provide the C/C++ Log Diagnostics logging? Your existing logging seems to indicate it is incorrectly using C++ instead of C (the opposite of the original issue that got fixed).

@PoignardAzur I don't understand -- there was a bug in processing of the compilerFragments. If the bug is fixed, then there's no need to output information on what caused it. The "language modes specified are incompatible" gives a hint as to the cause.

sean-mcmanus avatar Aug 08 '22 21:08 sean-mcmanus

-------- Diagnostics - 9/8/2022, 10:04:36 am
Version: 1.12.0
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "compilerPath": "C:\\msys64\\mingw64\\bin\\gcc.exe",
    "intelliSenseMode": "windows-gcc-x64",
    "cStandard": "gnu11",
    "cppStandard": "gnu++11",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "configurationProvider": "ms-vscode.cmake-tools",
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Custom browse configuration: 
{
    "browsePath": [
        "d:/pc data/desktop/******/build",
        "d:/pc data/desktop/******"
    ],
    "compilerPath": "c:/msys64/mingw64/bin/gcc.exe",
    "compilerFragments": [
        "-g",
        "-std=gnu99"
    ],
    "compilerArgsLegacy": []
}
Translation Unit Mappings:
[ D:\PC Data\Desktop\******\main.c ]:
    D:\PC Data\Desktop\******\main.c
Translation Unit Configurations:
[ D:\PC Data\Desktop\******\main.c ]:
    Process ID: 4620
    Memory Usage: 8 MB
    Compiler Path: c:/msys64/mingw64/bin/gcc.exe
    Includes:
        C:\MSYS64\MINGW64\INCLUDE\C++\12.1.0
        C:\MSYS64\MINGW64\INCLUDE\C++\12.1.0\X86_64-W64-MINGW32
        C:\MSYS64\MINGW64\INCLUDE\C++\12.1.0\BACKWARD
        C:\MSYS64\MINGW64\LIB\GCC\X86_64-W64-MINGW32\12.1.0\INCLUDE
        C:\MSYS64\MINGW64\INCLUDE
        C:\MSYS64\MINGW64\LIB\GCC\X86_64-W64-MINGW32\12.1.0\INCLUDE-FIXED
    Standard Version: c17
    IntelliSense Mode: windows-gcc-x64
    Other Flags:
        --g++
        --gnu_version=120100
Total Memory Usage: 8 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 3541
Number of files parsed: 1

Also specifying "C_Cpp.default.cStandard": "gnu11" explicitly in settings.json fixes the issue for the main.c in project root folder, other files still have the same issue

Jai-JAP avatar Aug 09 '22 04:08 Jai-JAP

I don't understand -- there was a bug in processing of the compilerFragments. If the bug is fixed, then there's no need to output information on what caused it. The "language modes specified are incompatible" gives a hint as to the cause.

It's a hint that doesn't help you unless you're familiar with CppTools internals (or you open a ticket).

At the very least, couldn't the tool write "language modes XXX and YYY are incompatible?". Or point to the config file that defines these language modes?

PoignardAzur avatar Aug 09 '22 09:08 PoignardAzur

The error message is caused by our code passing incorrect arguments to our external parser, so it's not supposed to be seen by users at all under normal circumstances. It wouldn't be an easy string to get changed. The parser has no knowledge about our particular config files or where the source of the invalid arguments is coming from. And we don't normally intercept the parser messages and turn them into new messages. I could file a bug on VS 2022 if you want, but I'm skeptical as to whether they'd improve the error message.

sean-mcmanus avatar Aug 09 '22 17:08 sean-mcmanus

I have the same problem using vscode.cpptools 1.13.0 and cmake-tools 1.13.4

The project has multiple targets, some programmed in C and others in C++. When opening any .c file in my project, VSCode add a problem with the next text:

command-line error: language modes specified are incompatible

Logs:

-------- Diagnostics - 16/9/2022, 11:09:13
Version: 1.13.0
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/gcc",
    "cStandard": "gnu17",
    "cppStandard": "gnu++17",
    "intelliSenseMode": "linux-gcc-x64",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "configurationProvider": "ms-vscode.cmake-tools",
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Custom browse configuration: 
{
    "browsePath": [
        "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src",
        "/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include",
        "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap11",
        "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common",
        "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10",
        "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap19",
        "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap09",
        "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap04",
        "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap17",
        "/home/jesus/Workspace/ssoo/ssoo-ejemplos/lib",
        "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap12",
        "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap13",
        "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap06",
        "/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/src",
        "/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include/fmt",
        "/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src"
    ],
    "compilerPath": "/usr/bin/g++",
    "compilerArgs": [],
    "compilerFragments": [
        "-g",
        "-Wall",
        "-fmessage-length=0",
        "-std=c++17"
    ]
}
Translation Unit Mappings:
[ /mnt/d/Workspace/ssoo/ssoo-ejemplos/src/cap09/fork-exec.c ]:
    /mnt/d/Workspace/ssoo/ssoo-ejemplos/src/cap09/fork-exec.c
Translation Unit Configurations:
[ /mnt/d/Workspace/ssoo/ssoo-ejemplos/src/cap09/fork-exec.c ]:
    Process ID: 1492
    Memory Usage: 37 MB
    Compiler Path: /usr/bin/g++
    Includes:
        /usr/include/c++/11
        /usr/include/x86_64-linux-gnu/c++/11
        /usr/include/c++/11/backward
        /usr/lib/gcc/x86_64-linux-gnu/11/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c17
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=110200
Total Memory Usage: 37 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 6376

compile_commands.json

[
{
  "directory": "/home/jesus/Workspace/ssoo/build/_deps/fmtlib-build",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/fmt.dir/src/format.cc.o -c /home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/src/format.cc",
  "file": "/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/src/format.cc"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/_deps/fmtlib-build",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/fmt.dir/src/os.cc.o -c /home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/src/os.cc",
  "file": "/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/src/os.cc"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap04",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/led-test.dir/led-test.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap04/led-test.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap04/led-test.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap06",
  "command": "/usr/bin/gcc   -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/softstack-c.dir/softstack.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap06/softstack.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap06/softstack.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap06",
  "command": "/usr/bin/g++   -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/softstack-cpp.dir/softstack.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap06/softstack.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap06/softstack.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap06",
  "command": "/usr/bin/gcc   -g -Wall -fmessage-length=0 -o CMakeFiles/syscall.dir/syscall.s.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap06/syscall.s",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap06/syscall.s"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap09",
  "command": "/usr/bin/gcc   -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/fork.dir/fork.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap09/fork.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap09/fork.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap09",
  "command": "/usr/bin/gcc   -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/fork-exec.dir/fork-exec.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap09/fork-exec.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap09/fork-exec.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/gcc   -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/fifo-client-c.dir/fifo-client.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/fifo-client.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/fifo-client.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/g++   -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/fifo-client-cpp.dir/fifo-client.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/fifo-client.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/fifo-client.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/gcc  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/fifo-server.dir/fifo-server.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/fifo-server.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/fifo-server.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/gcc  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/fifo-server.dir/__/common/timeserver.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common/timeserver.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common/timeserver.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/mqueue-client.dir/mqueue-client.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/mqueue-client.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/mqueue-client.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/mqueue-server.dir/mqueue-server.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/mqueue-server.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/mqueue-server.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/gcc  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/mqueue-server.dir/__/common/timeserver.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common/timeserver.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common/timeserver.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/socket-client.dir/socket-client.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/socket-client.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/socket-client.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/socket-server.dir/socket-server.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/socket-server.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/socket-server.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/gcc  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/socket-server.dir/__/common/timeserver.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common/timeserver.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common/timeserver.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/fork-pipe.dir/fork-pipe.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/fork-pipe.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/fork-pipe.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/fork-pipe.dir/__/common/factorial.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common/factorial.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common/factorial.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/gcc   -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/fork-redir.dir/fork-redir.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/fork-redir.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/fork-redir.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap10",
  "command": "/usr/bin/gcc   -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/signals.dir/signals.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/signals.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap10/signals.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap11",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/anom-shared-memory.dir/anom-shared-memory.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap11/anom-shared-memory.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap11/anom-shared-memory.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap11",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/anom-shared-memory.dir/__/common/factorial.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common/factorial.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common/factorial.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap11",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/shared-memory-client.dir/shared-memory-client.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap11/shared-memory-client.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap11/shared-memory-client.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap11",
  "command": "/usr/bin/gcc  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/shared-memory-server.dir/shared-memory-server.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap11/shared-memory-server.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap11/shared-memory-server.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap11",
  "command": "/usr/bin/gcc  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/shared-memory-server.dir/__/common/timeserver.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common/timeserver.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/common/timeserver.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap12",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/lib -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/threads.dir/threads.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap12/threads.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap12/threads.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap12",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/lib -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/pthreads.dir/pthreads.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap12/pthreads.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap12/pthreads.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap13",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/lib -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/threads-sync-counter.dir/threads-sync-counter.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap13/threads-sync-counter.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap13/threads-sync-counter.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap13",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/lib -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/threads-sync-factorial.dir/threads-sync-factorial.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap13/threads-sync-factorial.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap13/threads-sync-factorial.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap13",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/lib -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/pthreads-sync-counter.dir/pthreads-sync-counter.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap13/pthreads-sync-counter.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap13/pthreads-sync-counter.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap13",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/src -I/home/jesus/Workspace/ssoo/ssoo-ejemplos/lib -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/pthreads-sync-factorial.dir/pthreads-sync-factorial.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap13/pthreads-sync-factorial.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap13/pthreads-sync-factorial.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap17",
  "command": "/usr/bin/gcc   -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/mapped-files.dir/mapped-files.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap17/mapped-files.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap17/mapped-files.c"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap17",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/mapped-files-cpp.dir/mapped-files.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap17/mapped-files.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap17/mapped-files.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap19",
  "command": "/usr/bin/g++  -I/home/jesus/Workspace/ssoo/build/_deps/fmtlib-src/include -g -Wall -fmessage-length=0 -std=c++17 -o CMakeFiles/filelock-client.dir/filelock-client.cpp.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap19/filelock-client.cpp",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap19/filelock-client.cpp"
},
{
  "directory": "/home/jesus/Workspace/ssoo/build/src/cap19",
  "command": "/usr/bin/gcc   -g -Wall -fmessage-length=0 -std=c11 -o CMakeFiles/filelock-server.dir/filelock-server.c.o -c /home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap19/filelock-server.c",
  "file": "/home/jesus/Workspace/ssoo/ssoo-ejemplos/src/cap19/filelock-server.c"
}
]

This issue is about the error explanation, so I don't know if I should open a new issue.

jesustorresdev avatar Sep 16 '22 10:09 jesustorresdev

@aplatanado You're not configured correctly. You're currently using " "configurationProvider": "ms-vscode.cmake-tools"," for configuring, it's not sending us configuration info for the opened file so it's falling back to the C++ default. Are you able to properly configure the CMake Tools extension (e.g. run CMake: Configure)? If not, you should remove the configurationProvider setting and replace it with compileCommands.

sean-mcmanus avatar Sep 17 '22 02:09 sean-mcmanus

You were right, @sean-mcmanus. With compileCommands works fine. The problem is with ms-vscode.cmake-tools because it persists even after run CMake: Configure.

jesustorresdev avatar Sep 21 '22 21:09 jesustorresdev

So now we google the error message that doesn't mean anything and find this thread instead of knowing what's going wrong. I don't have any CMake or C++ files...

endolith avatar Oct 25 '22 15:10 endolith

For those still having this problem, changing "configurationProvider" to "none" in the command Palette(ctrl+shift+P) fixed my issue.

XandeLibs avatar Nov 05 '22 21:11 XandeLibs

For those still having this problem, changing "configurationProvider" to "none" in the command Palette(ctrl+shift+P) fixed my issue.

Actually for me the solution was to change the setting from 'ms-vscode.makefile-tools' to 'ms-vscode.cmake-tools', because I started the project with Make and then switched to CMake. Also I found it simpler to directly edit the file ('./.vscode/c_cpp_properties.json')

schwafe avatar Dec 15 '22 13:12 schwafe

Hey @sean-mcmanus, this issue might need further attention.

@PoignardAzur, you can help us out by closing this issue if the problem no longer exists, or adding more information.

github-actions[bot] avatar Mar 06 '23 11:03 github-actions[bot]

No information to add, but I think the underlying issue remains.

The fact that a lot of people seem to stumbling on this issue through google searches yet all of them have different issues and eventual fixes suggests a few things:

  • People keep bumping into the "command-line error: language modes specified are incompatible" message. Even if the specific bug that led me to bump into this message was fixed, other bugs and problems surface every now and then that trigger the same message.
  • People who search for this error message online find this thread and not much else, which means they don't have resources to know what went wrong besides "the language server broke".
  • When they eventually find a fix, that fix won't be helpful to the next person to bump into this message, because that person will have a different problem too which will need its own specific solution.

The only fix, besides individually looking at the config file of each user posting a complaint on this issue, is to have the cpptools extension display more informative error messages when something breaks, whether that break is due to an internal code error or a bad user config.

PoignardAzur avatar Mar 06 '23 11:03 PoignardAzur

Hey @sean-mcmanus, this issue might need further attention.

@PoignardAzur, you can help us out by closing this issue if the problem no longer exists, or adding more information.

github-actions[bot] avatar May 26 '23 11:05 github-actions[bot]

Not much to add, everything I said in the last message still holds (and the upvote count suggests a lot of people share the same frustrations).

Also, since the last message, I ran into this error again and still had no clue what I could do except shrug and use VsCode without a C language server.

PoignardAzur avatar May 26 '23 12:05 PoignardAzur

For those still having this problem, changing "configurationProvider" to "none" in the command Palette(ctrl+shift+P) fixed my issue.

Thank you for providing a solution.

I am worried that the VSCode team is failing to solve this for almost an year now.

tomoveu avatar Jun 09 '23 13:06 tomoveu

I must agree. I ran into this issue while forking a Github project for the RPi pico. I eventually solved the 'complaint' using the method above, but I still have no idea of the problem. The message gave no information and only a web search found this thread. At least better to have a more informative message if the issue can't be addressed.

ozarchie avatar Aug 24 '23 01:08 ozarchie

I've just encountered this issue and found a solution which seems unrelated to the configuration provider.

Just context: the problem which triggered this error and how I solved it

I just reopened a folder I haven't touched in a while because I wanted to add a new executable for it. I created the empty file, then opened the folder in Code. I saw the "language modes" error, but only for two files: my empty, newly-created source file and one other, which was simply a variant of another file (which was not affected by the error) where I was playing with an alternate implementation. A quick web search brought me to this issue... but not a solution.

The most common solution in this thread involves the selected configuration provider, but this folder has almost no VS Code configuration at all; the .vscode folder is entirely absent, and the only non-default user setting is cmake.configureOnOpen having been set to true. Lacking any idea how to proceed, I just kind of fiddled with things until I found something that those two files had in common — neither is actually referenced in my CMakeLists.txt. The new file because I'd only just created it and there wasn't even any code to compile and the "experiment" presumably because I never got far enough for compilation to be relevant.

Sure enough, creating add_executable(...) entries in CMakeLists.txt for each file resolved the issue.

Now, it certainly isn't ideal that the error message presented to me didn't set me on the path to solving it, but I agree with @PoignardAzur — that isn't really the bug being reported here. This issue isn't about configuration providers or CMakeLists.txt or whatever other conditions might make that error appear to the user; it's that a message which isn't intended for users — because it is completely meaningless to them — is nevertheless shown to users.

Further discussion of the issue

so it's not supposed to be seen by users at all under normal circumstances

I think this cuts to the heart of the problem; I disagree that it should be shown to "users" (normal users) under any circumstances. If CppTools has a "verbose" mode or some such which has been enabled, then sure! In that situation, a person has opted in to receiving information which isn't helpful for normal use, effectively indicating that they aren't a "normal user". But for normal users, during normal use, error messages really should give them some indication of how to proceed, even if circumstances prevent it from being specific to the encountered problem. They should be actionable in some way.

And we don't normally intercept the parser messages and turn them into new messages.

I wonder if this is, perhaps, a mistake. A person using CppTools is certainly aware that they're using VS Code. They're very probably aware that they're using CppTools. But if not for the comments in this thread, I wouldn't have any idea that VS 2022 was (or even could be — I'm on Linux) involved. And after reading the comments on that thread, that doesn't seem unusual. Nor do I feel it's unreasonable; we're trying to use CppTools, not develop it, and preferably not to troubleshoot it.

Personally, I'd consider #9684 "resolved" if CppTools, before displaying an error, checked whether that error was the string "command-line error: language modes specified are incompatible" and, if so, replaced it with the string "CppTools has encountered an unexpected error; that's probably a bug. Please create an issue at https://github.com/microsoft/vscode-cpptools/issues which includes the output of running C/C++: Log Diagnostics." (or something similar). It might not help the user directly, but it very much gives them at least an idea of what broad category of problem they've encountered (to whit, one they probably can't solve on their own) and how they might proceed, neither of which is true of the current error. Even then, it doesn't prevent other user-unfriendly errors from appearing, but that's something which would need addressed systematically, and "language modes" seems to be a common enough error (and to appear for enough different reasons) for it to be worth addressing on its own.

TL;DR: I think that error messages really should be actionable by the person seeing them. (This one in particular feels very much like a "chuck it in the log" error message, not "present it to the user as a problem with their code".) And it appears that obscuring even just this one, common, opaque message could improve user experience.

benblank avatar Oct 01 '23 19:10 benblank

I run into this issue repeatedly when I have a workspace that contains multiple independent CMake projects. The projects use different compilers (gcc-arm-none-eabi and host gcc). The issue seems to occur sometimes when I switch which CMake project folder is active. It can usually be resolved by either switching projects and recompiling, or reloading the VS Code window. I have the CMake Tools extension defined as the configuration provider, so this may very well be an issue with that extension instead. However, I thought I'd mention this as a yet another data point where there is an underlying issue that the error message does not help me pinpoint and resolve.

doxxx avatar Dec 22 '23 18:12 doxxx

For those still having this problem, changing "configurationProvider" to "none" in the command Palette(ctrl+shift+P) fixed my issue.

@doxxx this worked for me

pranjalchanda08 avatar Dec 24 '23 15:12 pranjalchanda08

For those still having this problem, changing "configurationProvider" to "none" in the command Palette(ctrl+shift+P) fixed my issue.

@doxxx this worked for me

I'll try it. I hope it continues to work after switching back to the CMake configuration provider. I'm not prepared to use it with the configuration provider set to none. That defeats the entire purpose of these extensions.

doxxx avatar Dec 25 '23 02:12 doxxx

The error message disappeared when I added the problematic source files in the CMakeLists.txt file and built it.

For example,

cmake_minimum_required (VERSION 3.5)

project (open_browser)
add_library(open_browser_objs file_parser.c)
add_executable(open_browser open_browser.c)

The reason is that the compilation args for those source files are changed from the default ones. The compilation args can be found in C/C++ output(maybe need to use debug logging level.)

The different compilation args:

  • before adding the problematic source files to the build target:
include: C:\MSYS64\UCRT64\INCLUDE\C++\13.2.0                                                                      
include: C:\MSYS64\UCRT64\INCLUDE\C++\13.2.0\X86_64-W64-MINGW32                                                   
include: C:\MSYS64\UCRT64\INCLUDE\C++\13.2.0\BACKWARD                                                             
define: __GXX_EXPERIMENTAL_CXX0X__=1                                                                              
define: __DBL_DENORM_MIN__=double(4.94065645841246544176568792868221372e-324L)                                    
define: __GXX_WEAK__=1                                                                                            
define: __GXX_RTTI=1                                                                                              
define: __DBL_MAX__=double(1.79769313486231570814527423731704357e+308L)                                           
define: __cplusplus=201703L                                                                                       
define: __DEPRECATED=1                                                                                            
define: __GNUG__=13                                                                                               
define: __EXCEPTIONS=1                                                                                            
define: __STDCPP_DEFAULT_NEW_ALIGNMENT__=16                                                                       
define: __WCHAR_UNSIGNED__=1                                                                                      
define: __DBL_EPSILON__=double(2.22044604925031308084726333618164062e-16L)                                        
define: __STDCPP_THREADS__=1                                                                                      
define: __DBL_NORM_MAX__=double(1.79769313486231570814527423731704357e+308L)                                      
define: __DBL_MIN__=double(2.22507385850720138309023271733240406e-308L)                                           
other: --g++

after adding the problematic source files to the build target:

include: C:\USERS\WENIJINEW\ECB\SRC\INCLUDE                                                         
define: __DBL_DENORM_MIN__=((double)4.94065645841246544176568792868221372e-324L)                                  
define: __DBL_MAX__=((double)1.79769313486231570814527423731704357e+308L)                                         
define: __STDC_VERSION__=201710L                                                                                  
define: __DBL_EPSILON__=((double)2.22044604925031308084726333618164062e-16L)                                      
define: __DBL_NORM_MAX__=((double)1.79769313486231570814527423731704357e+308L)                                    
define: __DBL_MIN__=((double)2.22507385850720138309023271733240406e-308L)                                         
other: --gcc 

The relevant issue and solution are also mentioned in the troubleshooting section: https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/troubleshoot.md#error-cmake-tools-is-unable-to-provide-intellisense-configuration

wenijinew avatar Dec 27 '23 03:12 wenijinew