简体   繁体   中英

Undefined reference to `_imp__glewInit@0'

I have built the glew lib so many times. My last build removed the undefined references to all the shader functions such as glCreateShader() . I think this build is the correct one cause I found out that Code:Blocks can open Visual Studio 6.0 projects so it had everything laid out for me.

I can compile my app without calling glewInit() but it results in a SEGFAULT right when glCreateShader() is called. Which is caused by not Initializing glew.

I need to turn it on but it wont let me XD

links: mingw32, glew32, opengl32, glu32, glut32

IDE: Code::Blocks

Compiler:MinGW32

Save yourself a lot of trouble and just add the glew.c to your project directly. I do not understand why people fight so hard to link to it externally. The license is friendly, and it is only one source file. Just remember to #define GLEW_STATIC .

Link glew32 after libs that use it.

In Ubuntu 18.04 to work OpenGL the GLEW should be installed:

apt-get install libglew-dev   

And it works when add linker option: "-lGLEW" to linker call, like in the Makefile for the FLTK:

...
# HOW TO LINK
.o$(EXEEXT):
  @echo "*** Linking $@..."
  $(CXX) $< $(LINKFLTK_ALL) -lGLEW -o $@

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM