Search code examples
visual-studioglutglfwglew

How can I install GLUT, GLUI, GLEW, and, GLFW so that I don't need to pull hairs every time I create a new project in VS?


I have solved the GL and GLUT part by installing NVidia CG toolkit. But, having continuous trouble with GLEW, GLFW, GL WTF W, etc.....

I want to install .h, .lib,and, .dll files related to GLUT, GLUI, GLEW, and, GLFW in such a location so that I don't need to pull my hairs every time I create a new project in Visual Studio 2003/2005/2008/2010/2012/20....... .

I am using 64 bit Windows-7.

But, others are bothering and confusing me every time I create a new project.


Solution

  • Create an empty project in which you will once setup once all necessary properties in:

    • C/C++ -> General -> Additional Include Directories
    • Linker -> General -> Additional Library Directories
    • Linker -> Input -> Additional Dependencies
    • All additional properties if any are required ...

    Then, use File -> Export Template from the VS menu to export project template, so you can use it every time you are creating a new project. More information about project templates can be found here:

    https://msdn.microsoft.com/library/xkh1wxd8(v=vs.100).aspx

    EDIT:

    Create an environment variable that will hold the path to your directory which contains the necessary libraries and headers (for example, GL_LIBS). Then, when setting up properties of the project to be exported, use this variable value instead an absolute path (for example: %GL_LIBS%\xyz_headers_dir). This way, if you want to change the location of the libraries, the only thing necessary is to change the environment variable and it will work. This is also helpful in situations when several team members work on the same project and don't want to keep these files in the same location.

    One more thing, since "Export template" does not work on VS2010 or older, you will have to do additional steps. In case you are using VS2010, it is only a small issue since there is a VS extension which you can use to export project templates:

    https://visualstudiogallery.msdn.microsoft.com/57320b20-34a2-42e4-b97e-e615c71aca24/

    If you are using an even older version, then you will have to create a custom wizard which enables you to export a VC++ project template:

    https://msdn.microsoft.com/en-IN/library/96xz4cw2(v=vs.90).aspx