Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default include paths for Mac not sufficient (c_cpp_properties.json) #944

Closed
JeffreyCA opened this issue Aug 3, 2017 · 9 comments
Closed
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service

Comments

@JeffreyCA
Copy link
Member

JeffreyCA commented Aug 3, 2017

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?

@dmaisano
Copy link

dmaisano commented Aug 3, 2017

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.

@bobbrow
Copy link
Member

bobbrow commented Aug 3, 2017

@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"

@JeffreyCA
Copy link
Member Author

Here is my copy if you still need it.

@bobbrow
Copy link
Member

bobbrow commented Aug 4, 2017

@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.

@JeffreyCA
Copy link
Member Author

@bobbrow Yes, /usr/include/i386exists. I just added it and also works.

@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Aug 4, 2017
@dmaisano
Copy link

dmaisano commented Aug 5, 2017

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.

@dmaisano
Copy link

dmaisano commented Aug 5, 2017

These are the settings I use for Windows and Mac, I appreciate the help @bobbrow @JeffreyCA :)

@bobbrow
Copy link
Member

bobbrow commented Aug 18, 2017

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.

@bobbrow bobbrow closed this as completed Aug 18, 2017
@bobbrow
Copy link
Member

bobbrow commented Aug 30, 2017

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".

@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

4 participants