[英]What is the correct way to include GLEW in a Mac OS X .framework?
Probably a very simple problem, but it's had me stumped.可能是一个非常简单的问题,但它让我难住了。
I've got an SDL/OpenGL/GLEW based static library that compiles (gcc/g++) and links fine on Windows. On OS X, the same codebase fails to compile claiming that it can't find the declaration of GL_NUM_EXTENSIONS and::glGetStringi() - which is since I've thrown GLEW in the mix (with only SDL and OpenGL, it builds fine on OS X too).我有一个基于 SDL/OpenGL/GLEW 的 static 库,它可以编译 (gcc/g++) 并在 Windows 上正常链接。在 OS X 上,相同的代码库无法编译,声称它找不到 GL_NUM_EXTENSIONS 和 :: 的声明glGetStringi() - 这是因为我已经将 GLEW 混入其中(只有 SDL 和 OpenGL,它在 OS X 上也能很好地构建)。
// globals.h
#include <glew.h>
#include <SDL/SDL.h>
// graphics.h
#include "globals.h"
bool HasGLExtension(const char* pName);
// graphics.cpp
#include <string>
#include "graphics.cpp"
bool HasGLExtension(const char* pName)
{
GLint numExtensions;
::glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions); // error
for (int i = 0; i < numExtensions; ++i)
{
if (strcmp(pName, (char*)::glGetStringi(GL_EXTENSIONS, i)) == 0) // error
{
return true;
}
}
return false;
}
What's the obvious that I'm missing?什么是我失踪的明显?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.