Operating System: macOS
Version: 10.12.6
I have the following settings enabled:
"C_Cpp.intelliSenseEngine": "Default",
"C_Cpp.intelliSenseEngineFallback": "Enabled",
I get include errors if I try to include the standard library iostream:
include errors detected. Please update your includePath. IntelliSense features for this translation unit
cannot open source file "endian.h" (dependency of "iostream")
In my c_cpp_properties.json file I have to add the following include path in order to resolve the include error:
"includePath": [
...
"/usr/include/machine",
...
],
This is because the missing endian.h file is present in /usr/include/machine.
Could you please add this extra path to the default include path list for Mac?
I am having the same error, I went into my c_cpp_properties.json settings and tried adding "/usr/include/machine", to the top of the includePath array with no success in suppressing and fixing the error. Would you be able to link a copy of your c_cpp_properties.json file.
@dmaisano try looking in /usr/include/i386. /usr/include/machine/endian.h just forwards there. If it's not there, then try find /usr/include -name "endian.h"
Here is my copy if you still need it.
@JeffreyCA, does /usr/include/i386 exist on your Mac? Given @dmaisano's report, it seems like adding /usr/include/i386 to the path would be more effective.
@bobbrow Yes, /usr/include/i386exists. I just added it and also works.
I was able to test out your copy of the settings file and it does work, I must have done something wrong in my attempt at adding /usr/include/machine to the includePath. I was able to test out @bobbrow's suggestion and it does work just as well which is nice to see both of these as viable solutions.
We released 0.12.3 which adds this path by default now. The next time you create a new c_cpp_properties.json file, you will see the path added.
The root cause for this is being tracked by new issue: #1005. Add "__LITTLE_ENDIAN__" to your "defines" array in c_cpp_properties.json and you won't need to add a path to "endian.h".