I'm starting a c++ project using SDL 2 and GLEW 2.0 which I want to compile by using g++ in the command line (I'm trying to avoid IDE(s) like Visual Studio or Code::Block). I was able to create a basic opengl triangle in the GameEngine class but once I added the Sprite class, I'm getting the following error :
g++ ./src/main.cpp ./src/gameEngine/GameEngine.cpp ./src/gameEngine/Sprite.cpp ./src/gameEngine/Sprite.h ./src/gameEngine/GameEngine.h -I./lib/SDL2_32/include -I./lib/GLEW2_32/include -L./lib/SDL2_32/lib -L./lib/GLEW2_32/lib -w -std=gnu++11 -lmingw32 -lSDL2main -lSDL2 -lOpenGL32 -lglew32 -o ./bin/main
C:\Users\DANIEL~1\AppData\Local\Temp\ccn1bkfX.o:Sprite.cpp:(.text+0x2a): undefined reference to `__glewDeleteBuffers'
C:\Users\DANIEL~1\AppData\Local\Temp\ccn1bkfX.o:Sprite.cpp:(.text+0x7f): undefined reference to `__glewGenBuffers'
C:\Users\DANIEL~1\AppData\Local\Temp\ccn1bkfX.o:Sprite.cpp:(.text+0x125): undefined reference to `__glewBindBuffer'
C:\Users\DANIEL~1\AppData\Local\Temp\ccn1bkfX.o:Sprite.cpp:(.text+0x141): undefined reference to `__glewBufferData'
C:\Users\DANIEL~1\AppData\Local\Temp\ccn1bkfX.o:Sprite.cpp:(.text+0x16a): undefined reference to `__glewBindBuffer'
C:\Users\DANIEL~1\AppData\Local\Temp\ccn1bkfX.o:Sprite.cpp:(.text+0x193): undefined reference to `__glewBindBuffer'
C:\Users\DANIEL~1\AppData\Local\Temp\ccn1bkfX.o:Sprite.cpp:(.text+0x1ae): undefined reference to `__glewEnableVertexAttribArray'
C:\Users\DANIEL~1\AppData\Local\Temp\ccn1bkfX.o:Sprite.cpp:(.text+0x1bf): undefined reference to `__glewVertexAttribPointer'
C:\Users\DANIEL~1\AppData\Local\Temp\ccn1bkfX.o:Sprite.cpp:(.text+0x217): undefined reference to `__glewDisableVertexAttribArray'
C:\Users\DANIEL~1\AppData\Local\Temp\ccn1bkfX.o:Sprite.cpp:(.text+0x228): undefined reference to `__glewBindBuffer'
collect2.exe: error: ld returned 1 exit status
Makefile:36: recipe for target 'all' failed
make: *** [all] Error 1
It seems that there's a linking error so that Sprite cannot access glew's definitions. I tried every single solution posted online but most of them concerns Microsoft visual studio or Code::Block and not the commandline.. Please help!