Fatal Error LNK 1104: Cannont Open File 'glut32.lib'

Hi all,
I have Visual C++.NET 2003 in my Windows XP Pro PC. I executed the attached 
OpenGL program "POINTSZ" and I got a fatal error  LNK 1104: Cannont Open 
File 'glut32.lib'.  Please help and advise me
 how to solve this problem.
Thanks in advance,
Scott Chang
//////---POINTSZ.C---//////
// Pointsz.c

// OpenGL SuperBible, Chapter 4

// Demonstrates OpenGL Primative GL_POINTS with point size

// Program by Richard S. Wright Jr.

#include "../../Common/OpenGLSB.h" // System and OpenGL Stuff

#include <math.h>



// Define a constant for the value of PI

#define GL_PI 3.1415f

// Rotation amounts

static GLfloat xRot = 0.0f;

static GLfloat yRot = 0.0f;



// Called to draw scene

void RenderScene(void)

{

GLfloat x,y,z,angle; // Storeage for coordinates and angles

GLfloat sizes[2]; // Store supported point size range

GLfloat step; // Store supported point size increments

GLfloat curSize; // Store current size

// Clear the window with current clearing color

glClear(GL_COLOR_BUFFER_BIT);

// Save matrix state and do the rotation

glPushMatrix();

glRotatef(xRot, 1.0f, 0.0f, 0.0f);

glRotatef(yRot, 0.0f, 1.0f, 0.0f);

// Get supported point size range and step size

glGetFloatv(GL_POINT_SIZE_RANGE,sizes);

glGetFloatv(GL_POINT_SIZE_GRANULARITY,&step);


// Set the initial point size

curSize = sizes[0];

// Set beginning z coordinate

z = -50.0f;

// Loop around in a circle three times

for(angle = 0.0f; angle <= (2.0f*3.1415f)*3.0f; angle += 0.1f)

{

// Calculate x and y values on the circle

x = 50.0f*sin(angle);

y = 50.0f*cos(angle);


// Specify the point size before the primative is specified

glPointSize(curSize);

// Draw the point

glBegin(GL_POINTS);

glVertex3f(x, y, z);

glEnd();

// Bump up the z value and the point size

z += 0.5f;

curSize += step;

}

// Restore matrix state

glPopMatrix();

// Flush drawing commands

glutSwapBuffers();

}

// This function does any needed initialization on the rendering

// context.

void SetupRC()

{

// Black background

glClearColor(0.0f, 0.0f, 0.0f, 1.0f );

// Set drawing color to green

glColor3f(0.0f, 1.0f, 0.0f);

}

void SpecialKeys(int key, int x, int y)

{

if(key == GLUT_KEY_UP)

xRot-= 5.0f;

if(key == GLUT_KEY_DOWN)

xRot += 5.0f;

if(key == GLUT_KEY_LEFT)

yRot -= 5.0f;

if(key == GLUT_KEY_RIGHT)

yRot += 5.0f;

if(key > 356.0f)

xRot = 0.0f;

if(key < -1.0f)

xRot = 355.0f;

if(key > 356.0f)

yRot = 0.0f;

if(key < -1.0f)

yRot = 355.0f;

// Refresh the Window

glutPostRedisplay();

}



void ChangeSize(int w, int h)

{

GLfloat nRange = 100.0f;

// Prevent a divide by zero

if(h == 0)

h = 1;

// Set Viewport to window dimensions

glViewport(0, 0, w, h);

// Reset projection matrix stack

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

// Establish clipping volume (left, right, bottom, top, near, far)

if (w <= h)

glOrtho (-nRange, nRange, -nRange*h/w, nRange*h/w, -nRange, nRange);

else

glOrtho (-nRange*w/h, nRange*w/h, -nRange, nRange, -nRange, nRange);

// Reset Model view matrix stack

glMatrixMode(GL_MODELVIEW);

glLoadIdentity();

}

int main(int argc, char* argv[])

{

glutInit(&argc, argv);

glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

glutCreateWindow("Points Size Example");

glutReshapeFunc(ChangeSize);

glutSpecialFunc(SpecialKeys);

glutDisplayFunc(RenderScene);

SetupRC();

glutMainLoop();

return 0;

}

 


0
Scott
8/19/2005 7:25:39 PM
comp.graphics.api.opengl 7071 articles. 1 followers. Post Follow

2 Replies
6193 Views

Similar Articles

[PageSpeed] 20

Scott Chang wrote:

> Hi all,
> I have Visual C++.NET 2003 in my Windows XP Pro PC. I executed the attached 
> OpenGL program "POINTSZ" and I got a fatal error  LNK 1104: Cannont Open 
> File 'glut32.lib'.  Please help and advise me
>  how to solve this problem.
> Thanks in advance,
> Scott Chang
<snip long code sample that does not help at all!>

Boy, there are a lot of new OpenGL programmers lately. This is GOOD, but it is a 
slight pain...

Anyway, to the problem: This is a compiler problem, and it is telling you 
EXACTLY what the problem is: it cannot find the glut32.lib library. Did you 
download and install it? If you did install it, then you need to tell your 
compiler WHERE it can find it. To make things simple, I copied the GLUT headers 
and library directly to my MSVC include and library folders, and the glut32.dll 
file to my Windows system32 folder.

-- 
Phil Frisbie, Jr.
Hawk Software
http://www.hawksoft.com
0
Phil
8/19/2005 9:38:54 PM
Scott Chang wrote:
> Hi all,
> I have Visual C++.NET 2003 in my Windows XP Pro PC. I executed the attached 
> OpenGL program "POINTSZ" and I got a fatal error  LNK 1104: Cannont Open 
> File 'glut32.lib'.  Please help and advise me
>  

You might need to install GLUT (it isn't really part
of OpenGL).

http://www.opengl.org/resources/libraries/glut.html


-- 
<\___/>
/ O O \
\_____/  FTB.    For email, remove my socks.

In science it often happens that scientists say, 'You know
that's a really good argument; my position is mistaken,'
and then they actually change their minds and you never
hear that old view from them again.  They really do it.
It doesn't happen as often as it should, because scientists
are human and change is sometimes painful.  But it happens
every day.  I cannot recall the last time something like
that happened in politics or religion.

- Carl Sagan, 1987 CSICOP keynote address

0
fungus
8/20/2005 11:19:55 AM
Reply: