GLUI.h Not Found – How to Resolve GLUI.h Not Found Error

homebrewmacosopen source

I installed glui using homebrew

$ brew info glui
glui: stable 2.36
C++ user interface library
http://glui.sourceforge.net/
 /usr/local/Cellar/glui/2.36 (3 files, 594K) *
  Built from source
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/glui.rb

However, when I try to use the header in C++ with <glui.h>, <GL/glui.h> or <GLUI/glui.h> it gives a ... not found error. How should I install glui so that it can be found by c++?

Best Answer

Homebrew places files in /usr/local/Cellar so you could use mdfind to locate the header file:

mdfind -name glui.h | grep Cellar

Then you could change your compiler to include the directory for that package:

clang -I /usr/local/Cellar/glui/2.36/include

Then you should be able to use the short path instead of hard coding your full glui.h into the source code.

#include <GL/glui.h>

So - don't change the install and instead change the search path for your C++ compiler to search the glui code installed is my advice. Even better, brew links the latest version of include files to /usr/local/include - so you should instead link to the general include and not a version-specific Cellar for just about all use cases where you don't want to pin one exact version of glui or another library.

clang -I /usr/local/include