mitaki28 / vscode-clang

Completion and Diagnostic for C/C++/Objective-C using Clang
MIT License
128 stars 24 forks source link

“'fileName' file not found" #32

Open salda opened 8 years ago

salda commented 8 years ago

VSCode Version: 1.5.2 OS Version: 7

Steps to Reproduce:

  1. Set up VSCode, C/C++ package, g++, Clang and GDB hopefully correctly.
  2. Include some file.

See http://stackoverflow.com/questions/39512079/vscode-filename-not-found. See Microsoft/vscode#12151 and https://github.com/Microsoft/vscode-cpptools/issues/234. image

san-chang commented 8 years ago

https://github.com/Microsoft/vscode-cpptools/issues/234 You installed to much extensions provide the same functionality I think.

  • C++ Intellisense&C/C++ Clang&C/C++ provide autocomplete
  • C/C++&Native Debug provide debug UI

for this Issue

you may need add c/c++ clang config to your user config or workspace config open these config file:

  1. press F1 and type "settings" then you can see "open : user settings" and "open : workspace settings;
  2. chose workspace settings or user settings
  3. add some line of config like this:
"clang.executable": "clang",

"clang.completion.enable": true,

"clang.cxxflags": [
    "-std=c++11",
    "-I/your/CPP/include/path1",
    "-I/your/CPP/include/path2"
],
"clang.cflags": [
    "-std=c99",
    "-Ic:/your/C/include/path1",
    "-Ic:/your/C/include/path2"
],

Hope that I can help you

salda commented 8 years ago

Maybe it seems too much, but when VSCode recommended the extensions for me and told me, that IntelliSense isn't working in this version, I installed those extensions just to use VSCode correctly, but it's hard for me to set up the environment. Adding "clang.cxxflags": [ "-std=c++14", "-IC:/cygwin64/usr/local/include/c++" ] didn't solve it, the other settings except the "clang.cflags" were already as default and I don't see a reason to use "clang.cflags" on C++ code, so I didn't use it. image

san-chang commented 8 years ago

have you try to use this in your cmd?

clang++ -std=c++14 -IC:/cygwin64/usr/local/include/c++

tell me if there is an error like this

fatal error : "file_name.h" file not found

if clang drop an error

you can use

g++ -M test.cpp

to show your include directory

if there is no error message

maybe other plugin report this error :)

salda commented 8 years ago

In the end, I was missing features in VSCode for C++ like showing all uses of specific variable/function and refactoring them, that I switched back to Visual Studio, sorry.

kevinokal commented 7 years ago

Thanks a lot @San0from. I was having the same issue and this fixed it for me.