在 cygwin 下构建 gl3 应用程序
我有一个小的 opengl 3.2 应用程序,我一直在使用标准 gnu 工具(gmake/gcc)在 Linux 上开发它。代码看起来相当可移植——我在 osx 上运行它没有任何问题,直到我开始使用 mac mini gl 驱动程序似乎不支持的 gl3 功能。我在同一个迷你电脑上有一个带有 Windows XP 的 Bootcamp 分区,如果可能的话,我想在那里运行我的应用程序。
Windows 驱动程序肯定支持 gl 3.2,但我在链接时遇到问题。这似乎是一个非常常见的问题,但我没有在网上找到任何使用 opengl > 解决问题的答案1.2 在 cygwin 下。我正在使用 glew-1.5.5 并像这样链接:
g++ -o glToy *.o -L/cygdrive/c/Program\ Files/glew-1.5.5/lib -lglew32 -lglut32 -lglu32 -lopengl32
但我得到一大堆这样的输出:
Program.o:/home/Jacob/glToy/Program.cpp:134: undefined reference to `__imp____glewUseProgram' Program.o:/home/Jacob/glToy/Program.cpp:235: undefined reference to `__imp____glewActiveTexture' Program.o:/home/Jacob/glToy/Program.cpp:73: undefined reference to `__imp____glewGetShaderiv' ...
你知道我做错了什么吗?或者这可能不是一个可行的设置?在 mac mini(2009 版)上实现此功能还有其他想法吗?谢谢!
i've got a small opengl 3.2 app that i've been developing on linux using the standard gnu tools (gmake/gcc). the code seems pretty portable--i had no problems running it on osx until i started using gl3 features that the mac mini gl drivers don't seem to support. i've got a bootcamp partition with windows xp on the same mini, and i'd like to run my app there if possible.
the windows drivers definitely support gl 3.2, but i'm having trouble linking. this seems like a really common issue, but i haven't found any answers online that address using opengl > 1.2 under cygwin. i'm using glew-1.5.5 and linking like so:
g++ -o glToy *.o -L/cygdrive/c/Program\ Files/glew-1.5.5/lib -lglew32 -lglut32 -lglu32 -lopengl32
but i get a whole lot of this sort of output:
Program.o:/home/Jacob/glToy/Program.cpp:134: undefined reference to `__imp____glewUseProgram' Program.o:/home/Jacob/glToy/Program.cpp:235: undefined reference to `__imp____glewActiveTexture' Program.o:/home/Jacob/glToy/Program.cpp:73: undefined reference to `__imp____glewGetShaderiv' ...
any ideas what i'm doing wrong? or perhaps this isn't a workable setup? other ideas for getting this going on the mac mini (2009 version)? thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您也可以跳过链接,只需获取 glew.c 并将其放入 /include (而不是像 glew.h 那样的 /include/GL ),然后将
#include 更改为
you can also skip linking, just get glew.c and put it in /include (not /include/GL like glew.h) and then change your
#include to <glew.c>
你没有正确链接glew或者glew被破坏了...与gl本身无关,
简单的修复只是使用扩展api并忘记glew。
you aren't linking glew properly or glew is broken... nothing to do with gl itself
the easy fix is just to use the extension api and forget about glew.