Fix
for "undefined reference to 'glewInit', or 'glewInit()@0', etc":
1. Link to all the content of the glew.
For Codeblocks:
Go to Settings -> Compiler -> Linker Settings -> Link
Libraries -> Click ADD -> Browse
for the Glew Directory/lib, select all the files from there and hit the OK Button.
or you can add them to Compiler -> Linker Settings -> Other linker options by writing like this:
WARNING: In both cases you need to write to Other linking options the following line:
- Cod:
-
-lopengl32
For DevCpp:
Go to Tools -> Compiler Options -> Compiler (tab) -> Select "Add the following commands when calling the compiler", and add there your
libraries by the following:
-l
<libraryname>Examples:
-l
SDL2 -l
SDL2main -l
mingw32 -l
opengl32 -l
glu32 -l
glew32For Microsoft Visual Studio:
Create a project: and go to project's Proprieties -> Switch on the top bar from Active(Debug) to All Configuration: -> Linker and Expand the list -> Input -> Additional Dependecies -> click on the screen to modify and select EDIT -> write there your
libraries as follows:
<libraryname>.lib
Examples:
SDL2.lib
SDL2main.lib
Also
for fixing this error, you have to define GLEW_STATIC (#define GLEW_STATIC), before including glew.h into your code.
Fix
for "No such file in the directory, No such file or directory, etc":
For Codeblocks:
Go to Settings -> Compiler -> Search Directories, and add there your files as follows:
In the compiler tab: click ADD and select your include folder (from the glew directory), and click ok.
In the linker tab: click ADD and select your lib folder (from the glew directory), and click ok.
For DevCpp:
Go to Tools -> Compiler Options -> Directories (tab), and add there your files as follows:
In the Binaries tab: click ADD (the small folder icon from the right side), and select your bin folder (from the glew directory), and click ok.
In the
Libraries tab: click ADD (the small folder icon from the right side), and select your lib folder (from the glew directory), and click ok.
In the C++ Includes tab and in the C Includes tab (do the same
for both of them): click ADD (the small folder icon from the right side), and select your include folder (from the glew directory), and click ok.
- don't forget to check one more time, if you really added them right.
For Microsoft Visual Studio:
Create a project: and go to project's Proprieties -> Switch on the top bar from Active(Debug) to All Configuration: -> VC++ Directories -> Include Directories -> click on the screen to modify and select EDIT -> Add there your include directory (from the glew folder);
After that go to the next line -> Library Directories -> click on the screen to modify and select EDIT -> Add there your include directory (from the glew folder);
Fix
for "The procedure entry point glewInit could not be located in the dynamic link library glew32.dll"
- this error is usually cause by misplacing the glew32.dll or installing a bad version of glew32.dll (a newer or an older version). To fix this simply download an older version of glew, and reinstall all the library's components, header files, library files, and the dll that comes with it. Link them up as I said above, or if you have already linked them you just need to replace the files, in the root (linked) directories (glew directory/include, glew directory/lib).
Fix
for "The program can't start because glew32.dll is missing from your computer. Try reinstalling the program to fix this problem".
- this error occures when trying to open a executable created with the glew library, which requires the glew32.dll installed in the same folder with the .exe file, or in windows/sys32. To fix this error you just need to install glew32.dll, and is not recommended to download one from the internet, because could not be compatible with your glew version, the one you used in your project, the one used by your compiler, if you misinstall the glew32.dll you will receive an another error (see the error above). What you can do is to download an entire version of glew. which includes all the header files,
libraries, and this particular glew32.dll, compatible
for those files.
This tutorial should fix all these errors:
You should also try this
Guide!