GLEW Linker Errors (undefined reference to `__glewBindVertexArray')

前端 未结 3 573
栀梦
栀梦 2020-12-03 23:56

I\'ve recently made the decision to re-write some OpenGL code for a game using im working on using non depreciated techniques. Instead of drawing primitives with glBegin() a

相关标签:
3条回答
  • 2020-12-04 00:39

    Try this:

    pkg-config --libs --static glew
    

    in the terminal. Then, copy the libs it gives you and paste after your gcc/g++ statement:

    g++ <your-file-name>.cpp -o <output-file-name> -lGL -lGLU -lglfw3 -lrt -lm -ldl -lXrandr -lXinerama -lXcursor -lXext -lXrender -lXfixes -lX11 -lpthread -lxcb -lXau -lXdmcp -lGLEW -lGLU -lGL -lm -ldl -ldrm -lXdamage -lX11-xcb -lxcb-glx -lxcb-dri2 -lxcb-dri3 -lxcb-present -lxcb-sync -lxshmfence -lXxf86vm -lXfixes -lXext -lX11 -lpthread -lxcb -lXau -lXdmcp 
    

    (some are repeated above because I used glfw too)

    This is supposed to solve your problem, because usually these libraries are not declared.

    0 讨论(0)
  • 2020-12-04 00:43

    This usually happens if you link GLEW statically, but don't inform the header about this to happen. For this you must define the preprocessor token "GLEW_STATIC". This is best done as a compiler option. In case of GCC, add -DGLEW_STATIC to your compiler command line.

    0 讨论(0)
  • 2020-12-04 01:02

    If you use Linux, FLTK ui library with OpenGL, see .../bin/fltk-config file for LDLIBS. It should contain also "-lGLEW" or you can add this option to the LDLIBS parameter when compile. Of course "libglew-dev" should be installed.

    0 讨论(0)
提交回复
热议问题