OpenGL run error

Started by
1 comment, last by Lord_Evil 17 years, 1 month ago
I have a problem with an OpenGL application I built. It works just fine on my pc, but when other users (non-developers) try to run it, it gives them a error and quit. The error, they say, is something about some "program configuration" and that they ought to re-install. Could anyone help me? I use MS VC++ 2005 Express with the following code:

#include <iostream>
#include<GL/glut.h>
#pragma(lib,"glut32.lib")
using namespace std;

float angle = 0.0;
float factor = 0.0;
float diff = 0.010;

void changeSize(int w, int h) {

	if(h == 0)
		h = 1;

	float ratio = 1.0* w / h;

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	
    glViewport(0, 0, w, h);

	
	gluPerspective(45,ratio,1,1000);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	gluLookAt(0.0,0.0,10.0, 
		      0.0,0.0,-1.0,
			  0.0f,1.0f,0.0f);


}

void processNormalKeys(unsigned char key, int x, int y) {

	if (key == 27) 
		exit(0);
}


void renderScene(void) {
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	if (factor>4)
			diff=-0.010;
	if (factor<1)
			diff=0.010;			
	glPushMatrix();
	glRotatef(angle,0.0,1.0,0.0);
	glBegin(GL_TRIANGLES);
		glColor3f(0.0f,1.0f,0.0f);
		glVertex3f(factor*(-0.5),factor*(-0.5),0.0);
		glVertex3f(factor*(0.5),0.0,0.0);
		glVertex3f(0.0,factor*(0.5),0.0);
	glEnd();
	glPopMatrix();
	angle++;
	factor+=diff;
	glutSwapBuffers();
}

void main(int argc, char **argv) {
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowPosition(100,100);
	glutInitWindowSize(320,320);
	glutCreateWindow("Mads er nice ;)");
	glutDisplayFunc(renderScene);
	glutIdleFunc(renderScene);
	glutReshapeFunc(changeSize);
	glutKeyboardFunc(processNormalKeys);
	glutMainLoop();
}

which gives me one warning : "main.cpp(3) : warning C4081: expected 'identifier'; found '(' "... Can anyone tell me what to a little noob like me can do to get this working... I have tried to throw glut32.dll and opengl32.dll in the same folder as the program when rar'ing it so people could use it. What to do ? :'( (and hmm, how do you make a code-box in here?) - madsravn
Advertisement
At the top of your code, it should be:

#pragma comment(lib, "glut32.lib")

you are missing "comment" keyword.
You need the VC++ 2005 Redist Package since computers without VC++ 2005 are missing some files (or file versions) that VC++ 2005 compiled programs depend on.
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!

This topic is closed to new replies.

Advertisement