Copy the code (Your own code of a program) and paste in the Visual Studio. There is the following error when you can execute that code.
The reason for coming to errors because we did not set the external dependencies and Freeglut.dll missing. First, we will set the external dependencies of the program.
To Set additional dependencies OpenGL FreeGLUT and GLEW to follow the given instructions or Please watch all the steps of the video which is given at the end of this lecture.
OpenGL in Visual Studio 2017
First, make sure that Visual Studio 2017 is downloaded and installed on your computer.
When you run the Visual Studio installer, make sure you select Custom Installation and add support for the C ++ language.
If you have already installed Visual Studio and have not added support for it, just rerun the installer, click “Edit,” and follow the steps above to add support for Visual C ++ follow it. If you have experienced any issue with the installation, then please must read the installation Guide of visual studio.
Visual Studio Include Library (Set additional dependencies)
Open the new project.
Next, select visual c++ after that select Empty project and also give the name of the project.
There you can see Solution Explorer if Solution Explorer does not show then you can show it by view button.
Then, right click on the project name in the Solution Explorer. And select add> new items.
Select the C++(.cpp) file. Also, give the name of the project. Then click the add button.
Now new need base code. Which you have already downloaded the ZIP file. Copy the code and paste it into the visual studio.
Now, need to set the environment or external dependencies of Progam to run.
Right-click on the project name and then click on properties.
Go to C/C++ General Additional include Directories. Here we need to add the additional library to execute the program.
Select the right corner button Edit Button. Then Browsing pin will open click here. Then go where the GLEW and FreeGLUT already saved.
First, add the freeGLUT. Note, only select include folder by a single click, not double-click. Next click the ‘Select Folder’ button.
We can also include directories same GLEW files as freeGLUT.
When both files will be added then click on OK button.
Now we will add linker additional files. Linker–>General–>Additonal library directories.
Now we will add the lib file not include file. Select freeglut.lib and click on the “select folder” button.
Next, same add the Glew’s lib file. When both files will be added then click the “OK” button.
Now we go to inside the linker–>Input–>additional dependencies. Then click on the Edit button here we write “freeglut.lib” and “glew32.lib”.Â And click “OK” button.
Now click on the “apply” button then click “OK” button.
Now add the Freeglut.dll and glew32.dll which is already given in ZIP file.
Right-click on the project name in the Solution Explorer. Then click “Open Folder in Window Explorer”.
Here we add the Freeglut.dll and “glew32.dll” which is already given in ZIP file.
Now your program is ready for execution. Now “Rebuild Solution” or Press Ctrl+Shift+B. Next “start Debugging” or Press F5. You can see the following output window will appear on the screen.
Note: this video is in the Urdu Language.
I hope you did enjoy this lecture “How to download FreeGlut.dll and how to set addition dependencies of the program?”. It’s a complete serious of OpenGL with C++. You can also download this file and use it in any other project as well.