Jump to content
  • Advertisement
Sign in to follow this  
yaazz

OpenGL trying to compile openGL on ubuntu 7.04 Kdevelop

This topic is 4162 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, I am trying to compile my openGL applications on Ubuntu 7.04 but am having a bit of trouble. this is the output from KDevelop
cd '/home/afreddin/g/debug' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" make -k 
make all-recursive
Making all in src
compiling g.cpp (g++)
In file included from /home/afreddin/g/src/g.cpp:6:
/home/afreddin/g/src/soabiro_input.h:36:28: warning: no newline at end of file
/home/afreddin/g/src/g.cpp: In function ‘void idle()’:
/home/afreddin/g/src/g.cpp:229: warning: converting to non-pointer type ‘unsigned char’ from NULL
/home/afreddin/g/src/g.cpp:235: warning: converting to ‘clock_t’ from ‘double’
mv -f .deps/g.Tpo .deps/g.Po
linking g (g++)
linking g (g++)
g.o: In function `main':
/home/afreddin/g/src/g.cpp:261: undefined reference to `glutInit'
/home/afreddin/g/src/g.cpp:274: undefined reference to `glutInitDisplayMode'
/home/afreddin/g/src/g.cpp:275: undefined reference to `glutInitWindowSize'
/home/afreddin/g/src/g.cpp:276: undefined reference to `glutCreateWindow'
/home/afreddin/g/src/g.cpp:277: undefined reference to `glutReshapeFunc'
/home/afreddin/g/src/g.cpp:278: undefined reference to `glutDisplayFunc'
/home/afreddin/g/src/g.cpp:279: undefined reference to `glutIdleFunc'
/home/afreddin/g/src/g.cpp:280: undefined reference to `glutMouseFunc'
/home/afreddin/g/src/g.cpp:281: undefined reference to `glutKeyboardFunc'
/home/afreddin/g/src/g.cpp:282: undefined reference to `glutSpecialFunc'
/home/afreddin/g/src/g.cpp:283: undefined reference to `glutMotionFunc'
/home/afreddin/g/src/g.cpp:284: undefined reference to `glEnable'
/home/afreddin/g/src/g.cpp:285: undefined reference to `glEnable'
/home/afreddin/g/src/g.cpp:286: undefined reference to `glutMainLoop'
g.o: In function `myReshape(int, int)':
/home/afreddin/g/src/g.cpp:246: undefined reference to `glViewport'
/home/afreddin/g/src/g.cpp:247: undefined reference to `glMatrixMode'
/home/afreddin/g/src/g.cpp:248: undefined reference to `glLoadIdentity'
/home/afreddin/g/src/g.cpp:250: undefined reference to `glFrustum'
/home/afreddin/g/src/g.cpp:252: undefined reference to `glFrustum'
/home/afreddin/g/src/g.cpp:255: undefined reference to `glMatrixMode'
g.o: In function `idle()':
/home/afreddin/g/src/g.cpp:237: undefined reference to `glutPostRedisplay'
g.o: In function `createObjects()':
/home/afreddin/g/src/g.cpp:41: undefined reference to `glMatrixMode'
/home/afreddin/g/src/g.cpp:45: undefined reference to `gluLookAt'
/home/afreddin/g/src/g.cpp:49: undefined reference to `glPushMatrix'
/home/afreddin/g/src/g.cpp:53: undefined reference to `glTranslatef'
/home/afreddin/g/src/g.cpp:54: undefined reference to `glScalef'
/home/afreddin/g/src/g.cpp:56: undefined reference to `glPushMatrix'
/home/afreddin/g/src/g.cpp:57: undefined reference to `glRotatef'
/home/afreddin/g/src/g.cpp:58: undefined reference to `glBegin'
/home/afreddin/g/src/g.cpp:60: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:61: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:62: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:63: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:64: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:65: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:66: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:67: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:69: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:70: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:71: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:72: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:73: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:74: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:75: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:76: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:77: undefined reference to `glEnd'
/home/afreddin/g/src/g.cpp:78: undefined reference to `glPopMatrix'
/home/afreddin/g/src/g.cpp:80: undefined reference to `glBegin'
/home/afreddin/g/src/g.cpp:81: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:82: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:83: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:84: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:85: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:86: undefined reference to `glEnd'
/home/afreddin/g/src/g.cpp:107: undefined reference to `glPopMatrix'
/home/afreddin/g/src/g.cpp:114: undefined reference to `glPushMatrix'
/home/afreddin/g/src/g.cpp:146: undefined reference to `glTranslatef'
/home/afreddin/g/src/g.cpp:150: undefined reference to `glRotatef'
/home/afreddin/g/src/g.cpp:152: undefined reference to `glBegin'
/home/afreddin/g/src/g.cpp:153: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:154: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:155: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:156: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:157: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:158: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:159: undefined reference to `glEnd'
/home/afreddin/g/src/g.cpp:161: undefined reference to `glLoadIdentity'
/home/afreddin/g/src/g.cpp:162: undefined reference to `glRotatef'
/home/afreddin/g/src/g.cpp:163: undefined reference to `glBegin'
/home/afreddin/g/src/g.cpp:164: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:165: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:166: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:167: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:168: undefined reference to `glEnd'
/home/afreddin/g/src/g.cpp:170: undefined reference to `glLoadIdentity'
/home/afreddin/g/src/g.cpp:171: undefined reference to `glRotatef'
/home/afreddin/g/src/g.cpp:172: undefined reference to `glBegin'
/home/afreddin/g/src/g.cpp:173: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:174: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:175: undefined reference to `glColor3f'
/home/afreddin/g/src/g.cpp:176: undefined reference to `glVertex3f'
/home/afreddin/g/src/g.cpp:177: undefined reference to `glEnd'
/home/afreddin/g/src/g.cpp:178: undefined reference to `glPopMatrix'
g.o: In function `display()':
/home/afreddin/g/src/g.cpp:193: undefined reference to `glMatrixMode'
/home/afreddin/g/src/g.cpp:194: undefined reference to `glClear'
/home/afreddin/g/src/g.cpp:195: undefined reference to `glViewport'
/home/afreddin/g/src/g.cpp:211: undefined reference to `glMatrixMode'
/home/afreddin/g/src/g.cpp:218: undefined reference to `glFlush'
/home/afreddin/g/src/g.cpp:219: undefined reference to `glutSwapBuffers'
collect2: ld returned 1 exit status
make[2]: *** [g] Error 1
make[2]: Target `all' not remade because of errors.
make[2]: Nothing to be done for `all-am'.
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
*** Exited with status: 2 ***


and this is the main source file
#include <stdlib.h>
#include <stdio.h>
#include <GL/glut.h>
#include <math.h>
#include <time.h>
#include "soabiro_input.h"

clock_t clk;
double cangle=0;
double eyeX,eyeY,eyeZ,centerX,centerY,centerZ,upX,upY,upZ;
gameInput* deviceInput;
keyboardPTR kbPTR; 
specialKeyboardPTR specKbPTR;
mouseClickPTR mouseClkPTR;
mouseMovePTR mouseMvPTR;
		
int vW,vH,vX=0,vY=0; //Viewport variables

double Hangle=0,Fangle=0,Bangle=0; //heading, Facing, Bullet    ANGLES
double sVelocity=0.0,sMass=10000,force=0,resultSpeed=1,acceleration=0.01;
double XComp,YComp,bullXComp,bullYComp;
double bullVelocity=0.1;
const double PI = 3.14152;
const double ROTATION_RATE = 25;

bool bulletFired=false;
double Sangle,X,Y,bullX,bullY;
GLdouble bullet[2]={0.0,0.0};
GLdouble ship[3][3]={{0.0,-0.2,0.0},{-0.1,0.1,0.0},{-0.1,0.1,0.0}};
GLdouble line[2][2]={{0.0,1.0},{0.0,-1.0,}};





void createObjects()
{
	/* map vertices to faces */
Sangle+=20;
	
	glMatrixMode(GL_MODELVIEW);
	gluLookAt(0.0, 0.0, 0.0,  //eye
			  0.0, 0.0, 0.0,  //lookat 
			  
			  0.0, 1.0, 0.0); //up
	
	if(bulletFired)
	{
		glPushMatrix();
		bullX=bullX+bullVelocity * sin(Bangle );
		bullY=bullY-bullVelocity * cos(Bangle );
		
		glTranslatef(bullX,bullY,0.0);
		glScalef(0.4,0.4,0.4);
		
		glPushMatrix();
		glRotatef(Sangle,1.0,1.0,0.5);
		glBegin(GL_QUADS);
		
		glColor3f(0.0,0.0,1.0);
		glVertex3f(-0.1,-0.1,-1.0);
		glColor3f(0.1,0.9,0.5);
		glVertex3f(0.1,-0.1,-1.0);
		glColor3f(1.0,0.5,1.0);
		glVertex3f(0.1,0.1,-1.0);
		glColor3f(1.0,0.5,0.9);
		glVertex3f(-0.1,0.1,-1.0);
		
		glColor3f(0.0,0.0,1.0);
		glVertex3f(-0.1,-0.1,1.0);
		glColor3f(0.1,0.9,0.5);
		glVertex3f(0.1,-0.1,1.0);
		glColor3f(1.0,0.5,1.0);
		glVertex3f(0.1,0.1,1.0);
		glColor3f(1.0,0.5,0.9);
		glVertex3f(-0.1,0.1,1.0);
		glEnd();
		glPopMatrix();
		
		glBegin(GL_QUADS);
		glColor3f(0.5,1.0,0.0); 
		glVertex3f(-0.1,-0.1,-1.0);
		glVertex3f(0.1,-0.1,-1.0);
		glVertex3f(0.1,0.1,-1.0);
		glVertex3f(-0.1,0.1,-1.0);
		glEnd();
		
		if (bullX<=-1 || bullX >= 1)
		{
			bulletFired=false;
			bullX=X;
			bullY=Y;
			
		}
		if (bullY<=-1 || bullY >= 1)
		{
			bulletFired=false;
			bullX=X;
			bullY=Y;
			
		}
		
	
		

		
		glPopMatrix();
	}
	else
	{
		bullX=X;
		bullY=Y;
	}
	glPushMatrix();
	
	//glScalef(0.1,0.1,0.1);
	if(deviceInput->keyLeft)
		Fangle = Fangle + ROTATION_RATE *(PI/180);
	if(deviceInput->keyRight)
		Fangle = Fangle - ROTATION_RATE * (PI/180);
	if(deviceInput->keyUp)
	{
		XComp = sVelocity * sin(Hangle) + acceleration * sin(Fangle);
        YComp = sVelocity * cos(Hangle) + acceleration * cos(Fangle);
              //Determine the resultant speed
       
        	sVelocity= sqrt( (XComp *XComp) + (YComp * YComp));
        printf("sVelocity %f \n",sVelocity);
        //Calculate the resultant heading, and adjust for arctangent by adding Pi if necessary
        if (YComp >= 0) Hangle = atan(XComp / YComp);
        if (YComp < 0 ) Hangle = atan(XComp / YComp) + 3.14152; //<-PI
  
	}


	X=X+sVelocity * sin(Hangle);
	printf("X= %f \n",X);
	Y=Y-sVelocity * cos(Hangle);
	printf("hangle=%fcoshangle= %f Y= %f \n",Hangle,cos(Hangle),Y);
	
	if (X<=-1 || X >= 1)
		X=-X;
	if (Y<=-1 || Y >= 1)
		Y=-Y;
	
	glTranslatef(X,Y,0.0);
	
	
	
	glRotatef(Fangle/(PI/180),0.0,0.0,1.0);
	//glScalef(0.5,0.5,0.5);
	glBegin(GL_TRIANGLES);
	glColor3f(1.0,0.0,0.0);
	glVertex3f(ship[0][0],ship[0][1],ship[0][2]);
	glColor3f(1.0,1.0,0.0);
	glVertex3f(ship[0][1],ship[1][1],ship[1][2]);
	glColor3f(1.0,1.0,1.0);
	glVertex3f(ship[0][2],ship[2][1],ship[2][2]);
	glEnd();
	
	glLoadIdentity();
	glRotatef(Fangle/(PI/180),0.0,0.0,1.0);
	glBegin(GL_LINES);
	glColor3f(0.0,1.0,0.0);
	glVertex3f(0.0,1.0,0.0);
	glColor3f(1.0,1.0,1.0);
	glVertex3f(0.0,-1.0,0.0);
	glEnd();
	
	glLoadIdentity();
	glRotatef(Hangle/(PI/180),0.0,0.0,1.0);
	glBegin(GL_LINES);
	glColor3f(0.0,1.0,1.0);
	glVertex3f(0.0,1.0,0.0);
	glColor3f(1.0,1.0,1.0);
	glVertex3f(0.0,-1.0,0.0);
	glEnd();
	glPopMatrix();


	deviceInput->keyUp=false;
	deviceInput->keyLeft=false;
	deviceInput->keyRight=false;
}



void display()
{
	/* display callback, clear frame buffer and Z buffer, rotate cube and draw
	 * swap buffers */
	 
	 glMatrixMode(GL_PROJECTION);
	 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glViewport(0,0,vW,vH);
	
	
	/*eyeX-=0.1;
	eyeY=0.0;
	eyeZ=-1.0;
	centerX=0.0;
	centerY=0.0;
	centerZ=0.0;
	upX=0.0;
	upY=1.0;
	upZ=0.0;
	gluLookAt(eyeX,eyeY,eyeZ,centerX,centerY,centerZ,upX,upY,upZ);*/
	
		
	
	glMatrixMode(GL_MODELVIEW);
	//glMatrixMode(GL_MODELVIEW);
	// glLoadIdentity();
    //glRotatef(1,1.0,0.0,0.0);
	 //glTranslated(block[0][0].getX(),block[0][0].getY(),0.0);
	createObjects();
	 
	 glFlush();
	 glutSwapBuffers();
	 
}

void idle()
{
	/*display */
	if (deviceInput->charKey == 'a')
	{
	
		deviceInput->charKey=NULL;
		Bangle=Fangle;
		bulletFired=true;
	}
	
		
	 clk = clock () + 1.0 ;
 if (clock() > clk)
	glutPostRedisplay();
	
}


void myReshape(int w, int h)
{
	vW=w;
	vH=h;
	glViewport(0,0,w,h);
	glMatrixMode(GL_PROJECTION); 
	glLoadIdentity();
	if (w <= h)
		glFrustum(-3.0,3.0,-3.0* (GLfloat) h/ (GLfloat)w,3.0* (GLfloat) h / (GLfloat) w, -1.0,-10.0);
	else
		glFrustum(-3.0,3.0,-3.0* (GLfloat) w/ (GLfloat)h,3.0* (GLfloat) w / (GLfloat) h, -1.0,-10.0);
	

	glMatrixMode(GL_MODELVIEW);
	//gluLookAt(0.0,0.0,0.5,0.0,0.0,-0.5,0.0,1.0,0.0);
}

int	main(int argc, char **argv)
{
	glutInit(&argc, argv);
	
	kbPTR = keyboard;
	specKbPTR=specialKeyboard;
	mouseClkPTR=mouseClick;
	mouseMvPTR=mouseMove;
	
	deviceInput = new gameInput;
	deviceInput->windowH=vH;
	deviceInput->windowW=vW;
	
	initInput(deviceInput);
	/* need both double buffering and Z buffer */
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(250,250);
	glutCreateWindow("createObjects");
	glutReshapeFunc(myReshape);
	glutDisplayFunc(display);
	glutIdleFunc(idle);
	glutMouseFunc(mouseClkPTR);
	glutKeyboardFunc(kbPTR);
	glutSpecialFunc(specKbPTR);
	glutMotionFunc(mouseMvPTR);
	glEnable(GL_DEPTH_TEST); /*enable hidden surface removal */
	glEnable(GL_TEXTURE_2D);
	glutMainLoop();
}

Anyone know how to fix this

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!