How to link glew in xcode
Asked Answered
A

1

9

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

Adit answered 11/7, 2013 at 18:37 Comment(0)
T
12

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:

screenshot

Tuition answered 11/7, 2013 at 19:18 Comment(3)
so it's not possible to use the command line to compile a simple opengl program ?Gesticulative
@Gesticulative it is. You need include the flag for linking with opengl and include the flag for other search headers.Tuition
Possible to update with modern xcode? The screens differInocenciainoculable

© 2022 - 2024 — McMap. All rights reserved.