2

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++?

  • It's not clear whether this would be suited here or on Stack Overflow. If you have code that fails to compile - please post that code and your dev environment (what C++ compiler / options are you using). And flag this for migration to SO. If you are using homebrew to install a package that depends on glui - that might be on topic here, but I'm guessing you are making code and hoping to use brew to simplify installing a dependancy... – bmike Feb 8 '16 at 16:16
  • @bmike the code that fails is #include <GL/glui.h>, so the only problem I have is that it can not find a header installed by homebrew, which I would expect to be put in the correct path automatically – Niek Feb 8 '16 at 16:44
2

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
  • 3
    brew automatically puts links inside /usr/local/include that point into the Cellar. So the compiler should just be pointed to /usr/local/include and it will find the linked files in /usr/local/Cellar/glui/2.36/include from there. Benefit of this is that other header files installed through brew will also be picked up by this one include command. Also if @Niek updates glui to a new version, the compiler will automatically pick that up as brew will change the link to point to the newer version. – Alistair McMillan Feb 8 '16 at 22:26
  • 1
    @AlistairMcMillan You are so correct! I missed the GL symlink and didn't try that first. Thanks for the better answer – bmike Feb 8 '16 at 22:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .