notskm / vscode-clang-tidy

MIT License
49 stars 25 forks source link

'ioStream' file not found #25

Open DeadRabbits307 opened 4 years ago

DeadRabbits307 commented 4 years ago

As the screenshots show clang-tidy does not find the MinGW header file iostream.

VS Code version: 1.44.2 OS: Windows 10, version 1903, build 18362.720 clang-tidy extension version: 0.4.1

clang/LLVM: version: 10.0 InstalledDir: C:\LLVM\bin

MinGW: version: x86_64-8.1.0-posix-seh-rt_v6-rev0 InstalledDir: C:\MinGW\mingw64

settings.json:

   "clang-tidy.executable": "C:\\LLVM\\bin\\clang-tidy",
    "clang-tidy.lintOnSave": true,
    "clang-tidy.checks": [
        "cppcoreguidelines-*",
        "clang-analyzer-*"
    ],
    "clang-tidy.compilerArgs": [
        "--target=x86_64-pc-windows-gnu"
    ],

03

As the PATH variable shows, according to this everything is set:

04

If I execute the same command vscode-clang-tidy is executing (shown in the OUTPUT window) in the cmd of Windows, no iostream error is shown:

C:\LLVM\bin\clang-tidy c:\Users\xx\Desktop\test\main.cpp --export-fixes=- --checks=cppcoreguidelines-*,clang-analyzer-*,clang-diagnostic-* --extra-arg=--target=x86_64-pc-windows-gnu

notskm commented 4 years ago

I can't reproduce this with gcc installed through scoop. I'm having internet issues at the moment, so I can't test further for another few days. Sorry for the wait.

jackgerrits commented 4 years ago

I am also hitting this. I am using the compile_commands.json produced by cmake. Settings are:

 "clang-tidy.buildPath": "${workspaceFolder}/build",
 "clang-tidy.checks": [
        "readability-*",
        "readability-braces-around-statements",
        "modernize-*",
        "performance-*",
        "-modernize-use-trailing-return-type",
        "-readability-uppercase-literal-suffix"
],

Ubuntu 20.04 Extension version: 0.5.1

$ clang-tidy --version
LLVM (http://llvm.org/):
  LLVM version 10.0.0

  Optimized build.
  Default target: x86_64-pc-linux-gnu
  Host CPU: znver2
notskm commented 4 years ago

@jackgerrits clang-tidy.buildPath does not currently accept variables like ${workspaceFolder}.

chocolacula commented 4 years ago

Have the same issue on Manjaro with default setup LLVM 10.0.0

batunpc commented 1 year ago

adding this in settings.json solved the issue for me

  "clang-tidy.compilerArgsBefore": [
    "-stdlib=libc++",
    "-isystem",
    "/opt/homebrew/opt/llvm/include/c++/v1"
  ]