c++ – Glew installation troubles in Visual Studio 2022


I have installed opengl through nuget: Install-Package nupengl.core.
My include section now:

#define GLEW_STATIC
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>

#pragma comment(lib, "opengl32.lib")

Without any other actions, when I try to start the project, I get an error: Unresolved external symbol glewExperimental. Ok, looks like I have to edit linker -> input -> additional dependencies. I download and install files from glew install page. As I understood, nuget already installs header files, so I placed only dll and lib files in the desired folders. I also linked glew32s.lib instead of glew32.lib, as I need static linking.
After that, I got new errors:

1>glew32s.lib(glew.obj) : error LNK2005: glewInit already defined in glew32.lib(glew32.dll)
1>glew32s.lib(glew.obj) : warning LNK4099: PDB '' was not found with 'glew32s.lib(glew.obj)' or at ''; linking object as if no debug info
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library

What am I doing wrong?

Leave a Reply

Your email address will not be published. Required fields are marked *