未定义引用`gluOrtho2D' [英] undefined reference to `gluOrtho2D'
问题描述
http://programanddesign.com/cpp/qt-opengl-code-example /
我正在尝试上面的例子,包括
I am trying out above example and included
#include <GL/glu.h>
#include <GL/glut.h>
但我得到一个gluOrtho2D未定义的错误。
as well. but I am getting a gluOrtho2D undefined error. what am I doing wrong here ?
推荐答案
你需要把OpenGL和GLU库放在你的对象中,'#include'指令不是一个库,它只是一个库可以为你做的参考。库有linux上的.so扩展,MacOS上的.dylib和windows上的.dll / .lib,你需要告诉我们你正在使用什么来编译(MinGW,VisualStudip,QtCreator),还告诉我们你链接什么库与。对于OpenGL,在linux是-lGL,在Windows是-lOpenGL32。
You need to put the OpenGL and GLU libraries in your object, the '#include' directive is not an library, it's just a reference of what the library can do for you. Libraries have the .so extension on linux, .dylib on MacOS and .dll / .lib on windows, you need to tell us What you are using to compile, ( MinGW, VisualStudip, QtCreator ) and also tell us what libraries are you linking with. for OpenGL, in linux is -lGL, in windows is -lOpenGL32.
这篇关于未定义引用`gluOrtho2D'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!