0

So I have been watching a tutorial on youtube for using openGL, Glew and SDL2 in c++. I compiled it (Im using Code Blocks) at first what seemed as correctly because I didnt get any errors or warnings but then In the tutorial we got to using glGenBuffers which caused an unidentified reference to show up. So i looked it up on google and got that I should have linked -lglew32s in front of the rest of the linked libraries. So my linked libraries under "Other Linker Options" are -lglew32s -lmingw32 -lSDL2main -lSDL2 -lopengl32 -lglew32 (in that order).

I combined my SDL2 includes with GL includes and linked that one folder in the compiler under 'Search Directories". For the libs i combined the two glew lib files (glew32 and glew32s) with the SDL2 libs and I linked that one folder for the linker in the "Search Directories".

I also put the glew32.dll and the sdl2.dll files inside of my debug folder of my project. This location works because this is where I have put all of my SDL dlls in before for the sdl stuff i have done in other projects.

And finally at the top of the header files for the classes and in main.cpp i put: #define GLEW_STATIC #include <SDL2/SDL.h> #include <GL/glew.h> In that order from the top.

But now I get the warning:
.drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized

I looked it up and I think it is a conflict with 2 libraries. So does that mean that http://sourceforge.net/projects/glew/files/glew/1.12.0/ was not the right download for mingw. Im not sure but im hoping someone can give me a solution to fixing the warning. So far the codes using glew run fine but im not sure if that will change in the future.

Liger
  • 17
  • 7
  • You cannot link agains glew32s and glew32 at the same time. Decide whether you want it statically linked (glew32s.lib) or dynamically linked (glew32.lib + glew32.dll). – BDL Jul 24 '15 at 07:10
  • Alright well I need it statically linked. So I took out -lglew32 and only have -lglew32s -lmingw32 -lSDL2main -lSDL2 -lopengl32 in the "Search Directories" linker tab. I also only put the sdl.dll file in the debug folder as there is no glew32s.dll only a glew32.dll file. Also I still have the header #include and #define GLEW_STATIC at the top. But I still get the warning .drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized – Liger Jul 24 '15 at 15:04
  • Are you using the pre-compiled libraries? It could be, that they are not working together with mingw. Another thing you can try: place the -lopengl32 as last element [as described here](http://stackoverflow.com/questions/11234386/compiling-simple-static-opengl-4-0-program-using-mingw-freeglut-and-glew). – BDL Jul 24 '15 at 15:32
  • Yeah I do believe they are pre compiled. I got it off of the official download site as mentioned above. I have -lopengl32 as the last element already. So do I need to compile the library myself? I think for now I will just stick with what I have unless there is a quick-ish fix because the warning doesn't seem to cause any problems for the time being. – Liger Jul 24 '15 at 15:42

0 Answers0