如何在Xcode中链接问题 [英] How to link glew in xcode

查看:136
本文介绍了如何在Xcode中链接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法通过xcode链接glew.我有glew库位于/usr/local/lib/libGLEW.dylib

当我在命令行中编译文件时:

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

但是当我在xcode中编译时,出现错误:

找不到"GL/glew.h"文件

代码:

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

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

我用xcode链接了问题

有屏幕截图

OS X 10.8.4,Xcode 4.6.1

解决方案

添加库仅处理二进制链接.您需要配置Xcode,以便它还能找到描述二进制文件内容的标头.

在Xcode项目设置中搜索:标题搜索路径

将路径添加到GLEW的标头(可能与库位于同一文件夹附近,可能位于/usr/local/include).更改导入以匹配.如果路径设置正确,则应为#include <glew.h>(#include <GL/glew.h> ).

对于Xcode初学者,以下是屏幕截图:

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

解决方案

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:

这篇关于如何在Xcode中链接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆