Search code examples
c++macosgccvisual-studio-codeclang

How to display the full error messages in VScode?


I've got a problem that's bothering me for a long time. I use VScode on macOS with standart clang compiller. Almost all error messages produced by the "gcc" are cut, and don't help me at all. I do not know is it a VScode thing or my compilling settings are wrong. Also, if someone could say why just using "usr/bin/clang++" in command parameter is not working, it'll be excellent...

Settings Problem


Solution

  • The problem matcher of the task shows only the first line of error messages. GCC and Clang wrap error messages on multiple lines resulting truncated errors in the VSCode "Problems" panel and tooltips.

    Pass the option -fmessage-length=0 to the compiler to direct it to not wrap lines. Modify "args" in your config.

    "args": [
      "-fmessage-length=0",
      "-Wall",
      "-Wextra",
      "-std=c++17",
      "-g",
      "${fileDirname}/**.cpp",
      "-o",
      "${fileDirname}"/${fileBasenameNoExtension}"
    ],