链接GLEW和其他链接,_glViewport是唯一未解决的问题 [英] Linking GLEW and others, _glViewport is the only unresolved

查看:68
本文介绍了链接GLEW和其他链接,_glViewport是唯一未解决的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用G ++将我的项目链接到glew32,glfw,opengl32,glu32等,所有内容都可以正常编译-但是在链接阶段,除了glViewport链接以外的所有内容,我都会收到此错误:

I'm using G++ to link my project to glew32, glfw, opengl32, glu32, etc, everything compiles fine - however at the link stage everything but glViewport links and I get this error:

对'_glViewport'的未定义引用.

undefined reference to '_glViewport'.

我觉得这很奇怪,因为其他一切都还不错,我有点无所适从.我希望就尝试或做的事情提出任何建议.

I find this... odd since everything else was fine and I'm kinda at a loss for what to do. I look forward to any advice on what to try and or do.

推荐答案

根据我的评论,编译do(Linux/cygwin)时,需要链接OpenGL库

As per my comment, you need to link with the OpenGL libraries, when you compile do (Linux/cygwin)

g++ -o target source.c -lGL

要链接到Mac OSX上的OpenGL库,是

To link against the the OpenGL libs on Mac OSX it is

g++ -o target source.c -framework OpenGL

这篇关于链接GLEW和其他链接,_glViewport是唯一未解决的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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