1

I'm doing GLEW and the referencing is troublesome (as for many). However, it doesn't makes sense to me why it isn't working since the required linking steps have been followed.

What annoys me the most is that I thought I "understood" the logic with linking.

"To use the GLEW library you must first include the header files by giving the compiler a search directory /Project/include for example. But if the function prototypes in the header want to use the functions in its whole you must link the library to your project so it can find the C files (since its glew)."

Now, judge by the images and my description where it fails.

https://i.stack.imgur.com/wo1fl.jpg

As you can see in the linked images. I have to what needs to be done. And it still displays the error.

Build log:

mingw32-g++.exe -Ldependecies\lib -LC:\Programming\BennyOGL\dependecies\lib -o bin\Debug\BennyOGL.exe obj\Debug\display.o obj\Debug\main.o -lmingw32 -lSDL2main -lSDL2 -lglew32s -lmingw32 -lSDL2main -lSDL2 -lglew32 obj\Debug\display.o: In function ZN7displayC2EiiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE': C:/Programming/BennyOGL/display.cpp:18: undefined reference to_imp__glewInit@0' collect2.exe: error: ld returned 1 exit status

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • 1
    Don't post images of your IDE, they are not informative. Find actual build logs and post those as text directly in the question. Find the formatting help page and make sure formatting in your post isn't wrecked. Chances are, you didn't actually link the library but this is impossible to tell from the pictures. – n. m. could be an AI Aug 03 '17 at 12:01
  • 1
    Is the library you're linking against `libglew32.so` or `libglew32.a`? Or does your lib directory contain both of those? – John Zwinck Aug 03 '17 at 12:13
  • As the images show. They are .lib libraries – Felix Bergman Aug 03 '17 at 15:56
  • It seems that the headers you use are not compatible with the libraries you're using: the `_imp__glewInit@0` symbol is expected by the header but the library doesn't provide it. This could be e.g. because you're using a static GLEW but don't let the header know. Look at the answers to the question this is a duplicate of. In most cases adding `glew.c` to your project is the simplest solution (yes, it's just one file!). – Kuba hasn't forgotten Monica Aug 05 '17 at 02:39

1 Answers1

0

Try including the extensions of the individual library files in linker settings and making the paths relative (there should be an option to do so when you press 'add'). Make the search directory path for the linker relative as well.

  • Yeah, I already tried that. And I got " ...\dependecies\lib\glew32.lib||No such file or directory| ". By referring only to their specific names "glew32" "glew32s" it links it. But then the function is undefined ofc. Also I tried linking them via build options instead of global, but same result. – Felix Bergman Aug 03 '17 at 16:12