Linking GLEW and others, _glViewport is the only unresolved

房东的猫 提交于 2021-02-16 21:12:32

问题


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:

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.


回答1:


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

g++ -o target source.c -lGL

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

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


来源:https://stackoverflow.com/questions/9879770/linking-glew-and-others-glviewport-is-the-only-unresolved

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!