问题描述
在尝试解决我的其他问题时,我在GLEW内陷入困境对于Mac,缺少__glewX*
符号,并发现它们受到GLEW_APPLE_GLX
的保护.
I grepped inside GLEW while trying to solve my other question, concerning missing __glewX*
symbols for Mac, and found that they are guarded by GLEW_APPLE_GLX
.
当我尝试使用定义了该标志的源代码构建GLEW时,会得到未定义的符号(类似于_glXGetClientString
之类的东西).与X11(-lX11
)链接无济于事.
When I attempt to build GLEW from source with that flag defined, I get undefined symbols (stuff like _glXGetClientString
). Linking against X11 (-lX11
) doesn't help.
问题:假设定义GLEW_APPLE_GLX
确实有意义,那么我该如何修复构建?
Question: assuming defining GLEW_APPLE_GLX
does indeed make sense, how can I fix the build?
推荐答案
在构建使用X Server(XQuartz)而不是CGL的应用程序时,还需要添加-lGL
.
When building an application that uses the X Server (XQuartz) instead of using CGL, you also need to add -lGL
.
通常,在OS X上构建GL软件时,您使用 OpenGL.framework (-framework OpenGL
),这将为您提供OpenGL和CGL/AGL功能,但省去了GLX.
Ordinarily when building GL software on OS X you use OpenGL.framework (-framework OpenGL
) and that gets you OpenGL and CGL/AGL functions but leaves out GLX.
您还应该抛弃任何包含到<OpenGL/gl.h>
之类的东西,并改用<GL/gl.h>
,因为这将指向/usr/X11R6/include/GL/...
而不是OpenGL框架标头.
You should also ditch any includes to things like <OpenGL/gl.h>
and use <GL/gl.h>
instead, as that will point to /usr/X11R6/include/GL/...
instead of the OpenGL framework headers.
这篇关于GLEW_APPLE_GLX生成GLEW时导致链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!