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

前端 未结 2 1695
礼貌的吻别
礼貌的吻别 2021-01-15 16:50

I\'ve just started using Linux (Mint 11), and recently, I decided to take up OpenGL programming as a hobby. I\'m finding the code and techniques relatively simple enough, ho

相关标签:
2条回答
  • 2021-01-15 17:04

    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)

    0 讨论(0)
  • 2021-01-15 17:12

    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
    
    0 讨论(0)
提交回复
热议问题