Installing GLEW and using it with Xcode

2019-07-10 07:39发布

问题:

So I already downloaded the lastest glew v. 1.9 from the site and make it in the terminal, what I cant figure out is how to add it successfully to a GLUT OpenGL Xcode project. I can add the OpenGl and GLUT frameworks very easily but I cant find any glew frameworks or something similar.

Main problem is that one of my files has #include GL/glew.h and it cant find it.

回答1:

While using 'Frameworks' is the Apple way of doing things, XCode will let you specify header paths and a shared library (as is the convention in Nixlike environments).

1) Go to your target's properties, 2) look for header search paths field and add your Glew headers to that. 3) Then look for the GLEW shared library (typically a '.a' or '.so' file) in the directory where you compiled GLEW. Add this directory to your target's library search paths and 4) then finally link against this library in your dependencies list.