Visual studio code C++ on Linux Manjaro: IncludePath issue

风流意气都作罢 提交于 2019-12-04 15:14:25

I had exactly same problem today. Here's how I fixed it:

Find where on your system do you have stddef.h for example by running sudo find / -name stddef.h

Mine for example returns:

/usr/include/linux/stddef.h
/usr/lib/clang/4.0.1/include/stddef.h
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/include/stddef.h

Pick any of these paths and add it to c_cpp_properties.json file, into includePath. You should be good to go then.

Your c_cpp_properties.json is missing the compilerPath attribute, so VSCode might be using the wrong compiler. To check, in the Command Palette (Ctrl+Shift+P), run "C/C++: Log Diagnostics". That will show the compiler path.

Also compare the output you see there to the output of:

  $ touch empty.c
  $ gcc -v -E -dD empty.c

At a minimum, you want the #include search paths to agree.

In this answer I have written up generic instructions on how to troubleshoot C++ compiler configuration in VSCode.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!