在 FreeBSD 中编译 C++/OpenGL

Compiling C++/OpenGL in FreeBSD

我正在尝试在 FreeBSD-10.2-RELEASE 中编译一些 C++/OpenGL 源代码。 具体来说,我遵循以下说明:

http://www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/#Building_on_Linux

在第 6 步中,我收到一条错误消息:

In file included from /home/(my username)/Downloads/OpenGL-tutorial_v0014_33/external/glew-1.9.0/src/glew.c:32:
/home/(my username)/Downloads/OpenGL-tutorial_v0014_33/external/glew-1.9.0/include/GL/glew.h:1180:14: fatal error: 
      'GL/glu.h' file not found
#    include <GL/glu.h>
             ^
1 error generated.
*** Error code 1

Stop.

我安装了graphics/glew、graphics/glfw、math/glm、graphics/libGL、graphics/libGLU等软件包,但还是失败。

我应该怎么做才能让它们发挥作用? 谢谢。

在 FreeBSD 中,OpenGL 包含位于 /usr/local/include,因此您需要 -I/usr/local/include 标志。

要正确制作教程link,您还需要替换

set(ALL_LIBS
    ${OPENGL_LIBRARY}
    GLFW_303
    GLEW_190
)

set(ALL_LIBS
    ${OPENGL_LIBRARY}
    glfw3
    GLEW
)

请注意,您似乎使用的是旧库中的 headers,这可能会导致更多问题。