nigels-com / glew

The OpenGL Extension Wrangler Library
Other
2.62k stars 614 forks source link

Using glew 2.1.0 with Windows 64-bit and MinGW #223

Closed brunomrsn closed 5 years ago

brunomrsn commented 5 years ago

I had many problems trying to use this library:

1) The binary comes with .lib files, so I couldn't run in CodeBlocks, VS Code or Eclipse, this only works in Visual Studio. 2) I found out I had to compile the glew source code, but using the steps from [https://github.com/nigels-com/glew] didn't work.

Then, for those who couldn't solve, this is the solution:

1) Download the sources and unzip them. 2) Open CMD (PowerShell has problems with the commas in the commands). 3) Enter the glew unziped folder (using cd command). 4) Execute each of these commands one by one:

5) Finally, copy the generated .a files to MinGW's lib folder, the .h files to MinGW's include/GL folder and the .dll files to SystemWOW (for 64-bit), then setup the compiler options to load the libraries.

If you want to build visualinfo as well:

OBS.: Many solutions I searched for didn't work because of the -nostdlib parameter missing, so that did the trick, at least for me. Some solutions say to add #define GLEW_STATIC before including the "GL/glew.h", but that wasn't necessary.

Good luck.

nigels-com commented 5 years ago

That looks aligned with what make SYSTEM=mingw is doing. Take a look at config/Makefile.mingw for the details.

DJ-Dav commented 1 year ago

some of the commands flood the terminal with: src/glew.c:19534:34: warning: cast between incompatible function types from 'PROC' {aka 'long long int (*)()'} to 'const char * (*)(void)' [-Wcast-function-type] 19534 | _wglewGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT"); Any clue what this means?

nigels-com commented 1 year ago

some of the commands flood the terminal with: src/glew.c:19534:34: warning: cast between incompatible function types from 'PROC' {aka 'long long int (*)()'} to 'const char * (*)(void)' [-Wcast-function-type] 19534 | _wglewGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)glewGetProcAddress((const GLubyte*)"wglGetExtensionsStringEXT"); Any clue what this means?

It's a legit warning, to be expected.