Installing GLUI using VC++ on windows

Here, how to installing glui on your windows system, before going to install the glui, the glut must be installed first

  1. Download glui library from http://glui.sourceforge.net/ in the files section u will find the latest release version of glui
  2. Extract the zip file somewhere in ur disk, then open the glui-2.36 directory (i use glui-2.36 version)
    under src directory u will find msvc directory, then open glui.sln file.
  3. Convert the solution (if needed)

    Converting the project solution

    Converting the project solution into VC++ project

  4. Select the _glui library and build the library (the glui library will build static library, if u prefer with dnamic library than choose _gluidlllibrary)
    Select only glui library project

    Select only glui library project

    Compiling

    Compiling

  5. After building the library, the lib file (glui32d.lib), glui32d.lib – ‘d’ for debug, will be stored in the msvc\lib directory
  6. Put the glui3d.lib file into C:\Program Files\Microsoft Visual Studio 9.0\VC\lib directory and rename to glui32.lib
  7. Put the glui.h file into C:\Program Files\Microsoft Visual Studio 9.0\VC\include directory
  8. Open new project and create new project and try to compile this (http://www.mizuno.org/gl/bs/) glui code

    Succesfull compiled project

    The compiled project

  9. Thats all

Note : For VS 2010 users, the error below may be generated when compiling the library.

error 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
       #ifdef _MSC_VER
       // Explicit template instantiation needed for dll
       template class GLUIAPI std::allocator<GLUI_String>;
       template class GLUIAPI std::vector<GLUI_String,
    std::allocator<GLUI_String> >;
       #endif
    
  2. Put #include <iterator> after #include <cstdlib>
  3. #include <cstdlib>
    #include <iterator>
    
  4. Build it as usual
Advertisements

72 thoughts on “Installing GLUI using VC++ on windows

  1. iam use VS2010 in windows 7 and have this erroe

    >—— Build started: Project: o, Configuration: Debug Win32 ——
    1> o.cpp
    1>LINK : fatal error LNK1104: cannot open file ‘glui32.lib’
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    i need help please :(

  2. still get the error “error C2252: an explicit instantiation of a template can only occur at namespace scope” even after pasting the code you gave

  3. Hello, I just found your blog and found it really useful, except that I have one problem. I did everything you said, with the fix and all, but I still get some errors.

    I am using Visual Studio 2010 on Windows 7, glui version 2.36.

    I built the _glui project, copied the .h and .lib files where you said, and then tried to run your example ( from http://www.mizuno.org/gl/bs/ ), and I get the following error:

    1>Test.obj : error LNK2001: unresolved external symbol “class GLUI_Master_Object GLUI_Master” (?GLUI_Master@@3VGLUI_Master_Object@@A)
    1>D:\Licenta\Project\Test\Debug\Test.exe : fatal error LNK1120: 1 unresolved externals

    I also tried using glui in my own project, and got the following errors:

    1>IOPBTS.obj : error LNK2019: unresolved external symbol “public: class GLUI * __thiscall GLUI_Master_Object::create_glui(char *,long,int,int)” (?create_glui@GLUI_Master_Object@@QAEPAVGLUI@@PADJHH@Z) referenced in function “void __cdecl InitGlut(int,char * *)” (?InitGlut@@YAXHPAPAD@Z)
    1>IOPBTS.obj : error LNK2001: unresolved external symbol “class GLUI_Master_Object GLUI_Master” (?GLUI_Master@@3VGLUI_Master_Object@@A)
    1>D:\Licenta\Project\IOPBTS\Debug\IOPBTS.exe : fatal error LNK1120: 2 unresolved externals

    I must mention that the errors in my project resulted from writing the following piece of code:

    GLUI *glui;
    glui = GLUI_Master.create_glui(“Menu”, 0, 928, 0);

    //————-Camera Position ——————-//
    GLUI_Rollout *cameraPos_rollout = glui->add_rollout(“Camera Position”, 1) ;

    Could you please help me with this?

    • which vs2010 version? usually the error shows that you are failed when building the library. Try to recompile the lib by rearranging the header. I hope it help, good luck.

  4. The problem is that glui compiled with no errors, but apparently it does not contain the rollout control. And when compiling the glui library there are no unresolved link errors. Just when I try to use it. I have VS 2010 Professional.

    The errors simply don’t make sense to me, and I don’t know what else to do. I tried recompiling the library a few times, both dynamic and static, and it just doesn’t work. Compiles well, no errors, but when I try to use it, it doesn’t work.

    • I solved the problem by adding this to my main program:
      extern “C” {
      FILE* _iob = NULL;
      }

      in case anyone else comes across my errors

    • I also get the error:
      error LNK2001: unresolved external symbol “class GLUI_Master_Object GLUI_Master” (?GLUI_Master@@3VGLUI_Master_Object@@A)

      The extern “C” tip did not solve the problem.

      I am using the dynamic library which compiled fine. I noticed that the compilation produced a glui32dlld.lib and glui32dlld.exp files. Are we supposed to copy the .exp file anywhere? Thanks.

  5. Thanks for posting this. Can you help me with the error I am getting when I try to build? I am using VS 2012 with glut 3.7.6. This is the error message:

    1>—— Build started: Project: _glui library, Configuration: Debug Win32 ——
    1> algebra3.cpp
    1> arcball.cpp
    1> glui.cpp
    1>c:\users\beclai\desktop\glui-2.36\src\include\gl\glui.h(1718): error C2252: an explicit instantiation of a template can only occur at namespace scope
    1>c:\users\beclai\desktop\glui-2.36\src\include\gl\glui.h(1719): error C2252: an explicit instantiation of a template can only occur at namespace scope
    1> glui_add_controls.cpp
    :
    :
    1>c:\users\beclai\desktop\glui-2.36\src\include\gl\glui.h(1718): error C2252: an explicit instantiation of a template can only occur at namespace scope
    1>c:\users\beclai\desktop\glui-2.36\src\include\gl\glui.h(1719): error C2252: an explicit instantiation of a template can only occur at namespace scope
    1> quaternion.cpp
    1> Generating Code…
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Thanks!

  6. Hey, I am using VS2010 on Windows8 and this is the error I get when I try to run the sample file provided on the site. Kindly help

    1>—— Build started: Project: abc, Configuration: Debug Win32 ——
    1>Build started 30-06-2014 10:53:22.
    1>InitializeBuildStatus:
    1> Creating “Debug\abc.unsuccessfulbuild” because “AlwaysCreate” was specified.
    1>ClCompile:
    1> bs.cpp
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(29): error C2144: syntax error : ‘__w64 unsigned int’ should be preceded by ‘;’
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(29): error C4430: missing type specifier – int assumed. Note: C++ does not support default-int
    1>f:\tutorial trials\abc\abc\bs.cpp(1055): error C4430: missing type specifier – int assumed. Note: C++ does not support default-int
    1>
    1>Build FAILED.
    1>
    1>Time Elapsed 00:00:00.53
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

  7. Superb! I was looking for this solution because glui32.lib library links with the LIBCD.lib, which is not supported on VS 2010. So recompiling the library does the job.

  8. Pingback: VS2010编译glui出错的解决办法 | Lianera's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s