3

I'm trying to compile some C++/OpenGL source codes in FreeBSD-10.2-RELEASE. To be specific, I'm following the instruction below:

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

In step 6, I got an error message says:

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.

I installed some packages such as graphics/glew, graphics/glfw, math/glm, graphics/libGL, graphics/libGLU, etc, but it still fails.

What should I do to make them work? Thank you.

2
  • Look at the -I<path> options passed to the compiler and check that there is one <path> such that <path>/GL/glu.h exists. Else, check that GL/glu.h can be found in the standard include directories of your compiler. Sep 25, 2015 at 9:11
  • @RenaudPacalet Okay, I'll give it a try. Thanks!
    – hwong
    Sep 25, 2015 at 12:06

1 Answer 1

3

In FreeBSD OpenGL includes are located in /usr/local/include, so you need -I/usr/local/include flag.

To make tutorials link properly, you'd also need to replace

set(ALL_LIBS
    ${OPENGL_LIBRARY}
    GLFW_303
    GLEW_190
)

with

set(ALL_LIBS
    ${OPENGL_LIBRARY}
    glfw3
    GLEW
)

Note that you seemingly using headers from older libraries, this might cause more problems.

1
  • I added flags such as -I/usr/local/include, -I/usr/local/include/GLFW, etc and got some errors saying: /tmp/tutorial15-9e4549.o: In function main': tutorial15.cpp:(.text+0x1f): undefined reference to glfwInit' (...and so on...) c++: error: linker command failed with exit code 1 (use -v to see invocation) Can I have some more advice, please? Thank you.
    – hwong
    Sep 26, 2015 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.