c++macosemacsclangflycheck

How to get Flycheck (using clang_complete) to recognize the OpenGL framework on Mojave


I'm trying to get Flycheck to correctly see where OpenGL is on my Mac, but it can't seem to find it. I've tried adding the following lines to my .clang_complete file, but nothing seems to work. I keep getting the error OpenGL/gl.h could not be found:

-framework OpenGL
-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers

This doesn't happen during compilation, it's just messing up static analysis and compilation by Irony. The directory I listed has gl.h and glu.h in it directly, which is probably why it didn't help to add, but I can't figure out how to get Irony to see the files correctly.

Edit: Using Flycheck for syntax checking, not Irony

Edit: macOS X Framework directory:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/
    OpenGL.framework/
        Headers/
        Modules/
        OpenGL.tbd/
        Versions/

Solution

  • Well, since no one seems to have an answer on this, I'll post my workaround. By symlinking /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers to /usr/local/include/OpenGL, you can give the checker the file path it wants, fixing the issue. Not the best solution, but a decent workaround nonetheless.