none
OpenGL

    Question

  • hi

    I want to use OpenGL library in my programm and I get the glut.h , glut.dll , glut32.dll , glut.lib and glut32.lib files . I pasted the glut.dll and glut32.dll in system32 folder and pasted glut.h in   ...\Microsoft Visual Studio 10.0\VC\include\GL   path    and pasted glut.lib and glut32.lib in   ...\Microsoft Visual Studio 10.0\VC\lib  .

    I am using the windows 7 and visual studio 2010 .

    Now I write a simple program like this :

     

    #include "stdafx.h"

    #include "gl/glut.h";

    void init(void)

    {

    glClearColor(1,1,1,0);

    glMatrixMode(GL_PROJECTION);

    gluOrtho2D(0,200,-10,150);

    }

    int _tmain(int argc, _TCHAR* argv[])

    {

    return 0;

    }

     

    When I build this solution I get some error like :

    Error 1 error LNK2019: unresolved external symbol _gluOrtho2D@32 referenced in function "void __cdecl init(void)" (?init@@YAXXZ) C:\Users\ALI\Desktop\o\o\o.obj o

    Error 2 error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function "void __cdecl init(void)" (?init@@YAXXZ) C:\Users\ALI\Desktop\o\o\o.obj o

    And ....

    I went to the properties page of solution and went this path :   Configuration Properties -> Linker -> Input -> Additional Dependencies .

    And I edited the Additional Dependencies and added this : glut.lib and glut32.lib

    Then I bulided the solution but still I get the same error above .

     What should I do ?

    Thanks

    Monday, May 10, 2010 8:03 PM

Answers

All replies

  • You need to tell Visual Studio where to find glut.lib and glut32.lib. Or simply move the lib and dll files to the folders that Visual Studio will always look, as done by the person in the link below

    http://www.cs.uiowa.edu/~cwyman/classes/common/howto/winGLUT.html

     

    Monday, May 10, 2010 8:24 PM
  • Thank you so much .

    That link was so useful .

    Monday, May 10, 2010 8:53 PM
  • Thank you so much  Brian.

    That link was so useful.

    Monday, January 10, 2011 3:58 PM
  • Hi!

    I tried what you say and I implemented everything that the link says,

    I have an error says      Error    3    error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?    e:\documents and settings\administrator\belgelerim\visual studio 2010\projects\degirmen\degirmen\degirmen.cpp    237    1    Degirmen

    and two warnings:

    Warning    1    warning C4627: '#include <gl/glut.h>': skipped when looking for precompiled header use    e:\documents and settings\administrator\belgelerim\visual studio 2010\projects\degirmen\degirmen\degirmen.cpp    1    1    Degirmen
    Warning    2    warning C4627: '#include <gl/GLU.h>': skipped when looking for precompiled header use    e:\documents and settings\administrator\belgelerim\visual studio 2010\projects\degirmen\degirmen\degirmen.cpp    2    1    Degirmen

    I understand nothing

    What should I do?

    Pelase,help me!

    Tuesday, March 22, 2011 9:21 PM
  • Nurko,

    I don't see a response so I figure nobody replied to you but you might want to try reading the error.  Without the actual source, it is hard to tell but check degirmen.cpp - if it doesn't have it, type: #include "StdAfx.h".  You can also I believe go into the Project options and switch off Precompiled headers - That's what's causing the StdAfx.h search.  This though has nothing to do w/ OpenGL but more with Visual Studio and C++.  Good Luck!

    Tuesday, March 29, 2011 6:29 PM