How can I solve `glew32.dll is missing from your computer` issue of my OpenGL program? -
when i'm trying build , run opengl+glew+glfw program, builds fine wont run, giving me error : "the program can't start because glew32.dll missing computer. try reinstalling program fix problem."
i linking glew32.lib
static library. using #define glew_static
.
then, why program prompting dll file?
#include <iostream> //#define glew_static // glew #include <include/gl/glew.h> // glfw #include <include/glfw/glfw3.h> //we define glew_static, since we’re using static version of glew library. #define glew_static // called whenever key pressed/released via glfw void key_callback(glfwwindow* window, int key, int scancode, int action, int mode) { std::cout << key << std::endl; if (key == glfw_key_escape && action == glfw_press) { //we close glfw setting windowshouldclose //property true. glfwsetwindowshouldclose(window, gl_true); } } // window dimensions const gluint width = 800, height = 600; // main function, here start application , run game loop int main() { std::cout << "starting glfw context, opengl 3.3" << std::endl; // initializes glfw glfwinit(); // set required options glfw glfwwindowhint(glfw_context_version_major, 3); glfwwindowhint(glfw_context_version_minor, 3); glfwwindowhint(glfw_opengl_profile, glfw_opengl_core_profile); glfwwindowhint(glfw_resizable, gl_false); // create glfwwindow object can use glfw's functions glfwwindow * window = glfwcreatewindow(width, height, "learnopengl", nullptr, nullptr); glfwmakecontextcurrent(window); if (window == null) { std::cout << "failed create glfw window" << std::endl; glfwterminate(); return -1; } // set required callback functions glfwsetkeycallback(window, key_callback); // set true glew knows use modern approach retrieving function pointers , extensions glewexperimental = gl_true; // initialize glew setup opengl function pointers if (glewinit() != glew_ok) { std::cout << "failed initialize glew" << std::endl; return -1; } // define viewport dimensions glviewport(0, 0, width, height); // game loop while (!glfwwindowshouldclose(window)) { // check if events have been activiated (key pressed, mouse moved etc.) , call corresponding response functions glfwpollevents(); // render // clear colorbuffer glclearcolor(0.2f, 0.3f, 0.3f, 1.0f); glclear(gl_color_buffer_bit); // swap screen buffers glfwswapbuffers(window); } // terminate glfw, clearing resources allocated glfw. glfwterminate(); return 0; }
i linking glew32.lib
that's went wrong, glew32.lib import library dll version. if don't want dependency on glew32.dll need link static link library. name glew32s.lib
. defining glew_static otherwise has no effect on this.
guessing how have gone wrong, beware pre-built binaries available @ sourceforge include glew32.lib. you'll have build glew32s.lib yourself. in general pretty hard requirement, important use exact same compiler version , compiler options use build rest of code. read project's readme.txt file build instructions, had no trouble whatsoever building msvc provided project files.
the full list of library names:
- glew32.lib: release build, requires glew32.dll
- glew32d.lib: debug build, requires glew32d.dll
- glew32s.lib: release build, static link library
- glew32sd.lib: debug build, static link library
you can optionally build mx (multiple rendering context) versions of these libraries, "mx" appended names.
Comments
Post a Comment