Why won't this GLUT program compile? Am I missing libraries or headers?

▼魔方 西西 提交于 2019-12-01 10:58:38

be sure you have installed libglew-dev and freeglut3-dev with

sudo apt-get install libglew-dev freeglut3-dev

and then link to this libs in your Makefile or compile command with

-lglut -lGLEE

for example

g++ -lglut -lGLEW -o test main.cpp

(this is how I compiled your example)

In Linux you don't specify the paths to the library files to link to, but only the library names. The linker knows a list of paths were to look for in the libraries. Also libraries contain references to all the other libraries they require. To compile/link a GLUT programm the following command line is usually sufficient

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