GLEW Issues with Visual Studios

I tried several ways to get GLEW to work with my VS2010 project. No success. At first, I tried using pre-created libraries and DLLs from the website. I downloaded these pre-created files from http://glew.sourceforge.net/index.html and did something like: setting up GLEW windows?

  • .h were placed in C: \ Program Files (x86) \ Microsoft SDK \ Windows \ v7.0A \ Include

  • .lib files were placed in C: \ Program Files (x86) \ Microsoft SDK \ Windows \ v7.0A \ Lib \ x64 (I also put them on one level just in case)

  • glew32.dll switched to C: \ Windows \ SysWOW64

  • linker-> add add glew32.lib, GlU32.lib and OpenGL32.lib for additional dependencies

  • Preprocessor definitions: enter GLEW_BUILD and GLEW_STATIC (my program should be a DLL, but others seem to be successful with STATIC, so I include both)

When I run the program with these settings, glewInit () is not that GLEW_OK. Although glewInit () fails, it still recognizes this function strangely. When I use another glew function, such as "glCreateProgram ()", I get the following errors:

Error 56 error LNK2020: unresolved token (0A000327) __glewCreateProgram C:\Users\aab\studyWrist\Visualization\libCoin3D\ShaderHandler.obj libCoin3D Error 57 error LNK2001: unresolved external symbol __glewCreateProgram C:\Users\aab\studyWrist\Visualization\libCoin3D\ShaderHandler.obj libCoin3D Error 58 error LNK1120: 2 unresolved externals C:\Users\aab\studyWrist\Visualization\libCoin3D\Debug\libCoin3D.dll libCoin3D 

So, some other stackoverflow suggestions are to rebuild glew. So I tried to build glew32d in VS2010. I followed OpenGL: how to compile glew32.dll from the source file and got glew32d.dll and glew32d.lib.

  • put glew32d.lib in C: \ Program Files (x86) \ Microsoft SDK \ Windows \ v7.0A \ Lib \ x64 (the program only recognizes lib if I put it in the x64 folder and not the level up)

  • glew32d.dll switched to C: \ Windows \ SysWOW64

  • linker-> input add glew32d.lib (this one changed), GlU32.lib and OpenGL32.lib for additional dependencies

  • Preprocessor Definitions: Enter GLEW_BUILD and GLEW_STATIC

My following errors are caused only by glewInit:

 Error 56 error LNK2028: unresolved token (0A000383) "extern "C" unsigned int __cdecl glewInit(void)" ( ?glewInit@ @$$J0YAIXZ) referenced in function "public: __cdecl MasterCube::MasterCube(void)" ( ??0MasterCube@ @ $$FQEAA@XZ ) C:\Users\aab\studyWrist\Visualization\libCoin3D\MasterCube.obj libCoin3D Error 57 error LNK2019: unresolved external symbol "extern "C" unsigned int __cdecl glewInit(void)" ( ?glewInit@ @$$J0YAIXZ) referenced in function "public: __cdecl MasterCube::MasterCube(void)" ( ??0MasterCube@ @ $$FQEAA@XZ ) C:\Users\aab\wristuptodate\studyWrist\Visualization\libCoin3D\MasterCube.obj libCoin3D 

Any idea what goes wrong and how can I fix it?

+4
source share
2 answers

Do not add them to system directories. You should not throw things in system directories. Or in the MSVC directories. You should have your place somewhere on your drive for these things so that you don't accidentally break things. You tell your tools, for example, Visual Studio, where you can find your library, instead of putting your library in tools, for example, in visual studios. You can save your library in project directories. You can make the following settings to install GLEW. I assume that you have created a VC ++ win32 console application project.

Step 1. Creating a directory in the project directory allows you to assume the directory name " thirdparty "

Step 2. Copy and run the glew-1.9.0 folder in the ThirdParty directory

Step 3. Now go to the menu properties Project β†’ (projectName) .. or press Alt + F7. You will see the project properties window.

step 4. goto Properties of the congruence-> VC ++ Options. From there on the right side give the way to the glew library. The Include directories give the path: $ (ProjectDir) thirdparty \ glew-1.9.0 \ include; The library directories give the path: $ (ProjectDir) thirdparty \ glew-1.9.0 \ lib;

Now follow the last step for the link.

step 5. goto linker-> input option. Link glew32.dll.In Optional Dependencies: glew32.dll;

+6
source

It’s best to add GLEW to the project folder and link it to your application. You can find a step-by-step guide to linking GLEW (and several other libraries) here:

http://solarianprogrammer.com/2013/05/10/opengl-101-windows-osx-linux-getting-started/

Just ignore the parts that are not relevant to you, and go to the part that described how to create an OpenGL project on Windows.

+2
source

Source: https://habr.com/ru/post/1482297/


All Articles