How to link glew in xcode

▼魔方 西西 提交于 2019-12-10 03:15:05

问题


I can't link glew with xcode. I have glew library is located in /usr/local/lib/libGLEW.dylib

When i compile file in command line all right:

g++ /usr/local/lib/libGLEW.dylib -framework OpenGL main.cpp

But when i compile in xcode, i get error:

'GL/glew.h' file not found

Code:

#include <iostream>
#include <GL/glew.h>

int main(int argc, const char * argv[])
{
    // insert code here...
    std::cout << "Hello, World!\n";
    return 0;
}

Im linked glew with xcode

there screenshot

OS X 10.8.4, Xcode 4.6.1


回答1:


Adding the library only handles the binary linking. You need to configure Xcode so it can also find the headers describing the contents of the binary.

In Xcode Project Settings search for: Header Search Paths

Add the path to the headers for GLEW (probably near the same folder as the library maybe /usr/local/include). Change the import to match. It should be #include <glew.h> (or #include <GL/glew.h>) if the path gets setup correctly.

For Xcode beginners, here is a screenshot:



来源:https://stackoverflow.com/questions/17600917/how-to-link-glew-in-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!