Saturday, 18 August 2012

OpenGL beginning guide(glui)

1. Download the latest version of glui sourse code. (mine was glui-2.36)
2. Extract the zip file, and open the src/msvc/glui.sln file in vc++
3. Select the _glui library and build the library.
4. After building the library, the lib file (glui32d.lib), glui32d.lib – ‘d’ for debug, will be stored in the msvc\lib directory.
5. Put the glui32d.lib file into C:\Program Files\Microsoft Visual Studio 10.0\VC\lib directory and rename to glui32.lib
6. Put the glui.h file into C:\Program Files\Microsoft Visual Studio 10.0\VC\include directory.
7. Create new project and try to compile. That's all.

Note : For VS 2010 users, the error below may be generated when compiling the library.
 
1error C2252: an explicit instantiation of a template can only occur at namespace scope

Try this,
  1. Cut the corresponding block code and paste outside the class GLUIAPI GLUI_CommandLine definition
    1#ifdef _MSC_VER
    2// Explicit template instantiation needed for dll
    3template class GLUIAPI std::allocator<GLUI_String>;
    4template class GLUIAPI std::vector<GLUI_String,
    5std::allocator<GLUI_String> >;
    6#endif
  2. Put #include <iterator> after #include <cstdlib>
    1#include <cstdlib>
    2#include <iterator>

  3. Build it as usual

1 comment:

  1. I am using VS 2012 and after getting the error regarding explicit instantiation, I added the code you mentioned. However, with the first block of code I am now getting the error "argument list for class template is missing." How do I resolve this? Sorry, I am new to VS and C++.

    ReplyDelete