In my computer science class, we wre beginning a unit with OpenGL, so I installed the stuff my instructor provided on my Vista computer. This included various OpenGL and GLUT libraries, C++ headers, and dll's. However, things started going wrong - I first got the error that g++ couldn't find cc1plus.
After I tried copying cc1plus to C:\MinGW\bin, that error went away, only to be replaced by a number of assembler errors. When I tried to compile the test file provided by my instructor, I got this:
Quote:
C:\Users\----\Documents\GraphicsFiles\GraphicsFiles>g++ testgl.cpp -lglut32 -lglu32 -lopengl
./ccCUbaaa.s: Assembler messages:
./ccCUbaaa.s:4: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:5: Error: invalid character '_' in mnemonic
./ccCUbaaa.s:14: Error: junk `@12' after expression
./ccCUbaaa.s:19: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:20: Error: invalid character '_' in mnemonic
./ccCUbaaa.s:27: Error: junk `@8' after expression
./ccCUbaaa.s:32: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:33: Error: invalid character '_' in mnemonic
./ccCUbaaa.s:40: Error: junk `@8' after expression
./ccCUbaaa.s:139: Error: junk `@4' after expression
./ccCUbaaa.s:149: Error: junk `@16' after expression
./ccCUbaaa.s:155: Error: junk `@12' after expression
./ccCUbaaa.s:161: Error: junk `@12' after expression
./ccCUbaaa.s:167: Error: junk `@12' after expression
./ccCUbaaa.s:173: Error: junk `@12' after expression
./ccCUbaaa.s:179: Error: junk `@12' after expression
./ccCUbaaa.s:185: Error: junk `@12' after expression
./ccCUbaaa.s:191: Error: junk `@12' after expression
./ccCUbaaa.s:197: Error: junk `@12' after expression
./ccCUbaaa.s:203: Error: junk `@12' after expression
./ccCUbaaa.s:209: Error: junk `@12' after expression
./ccCUbaaa.s:215: Error: junk `@12' after expression
./ccCUbaaa.s:220: Error: junk `@8' after expression
./ccCUbaaa.s:223: Error: junk `@4' after expression
./ccCUbaaa.s:226: Error: junk `@4' after expression
./ccCUbaaa.s:229: Error: junk `@4' after expression
./ccCUbaaa.s:242: Error: junk `@4' after expression
./ccCUbaaa.s:248: Error: junk `@16' after expression
./ccCUbaaa.s:250: Error: junk `@0' after expression
./ccCUbaaa.s:280: Error: junk `@16' after expression
./ccCUbaaa.s:283: Error: junk `@4' after expression
./ccCUbaaa.s:285: Error: junk `@0' after expression
./ccCUbaaa.s:296: Error: junk `@32' after expression
./ccCUbaaa.s:299: Error: junk `@4' after expression
./ccCUbaaa.s:301: Error: junk `@0' after expression
./ccCUbaaa.s:320: Error: junk `@72' after expression
./ccCUbaaa.s:369: Error: junk `@0' after expression
./ccCUbaaa.s:388: Error: junk `@72' after expression
./ccCUbaaa.s:390: Error: junk `@0' after expression
./ccCUbaaa.s:393: Error: junk `@0' after expression
./ccCUbaaa.s:398: Error: junk `@8' after expression
./ccCUbaaa.s:402: Error: junk `@8' after expression
./ccCUbaaa.s:442: Error: junk `@16' after expression
./ccCUbaaa.s:444: Error: junk `@0' after expression
./ccCUbaaa.s:455: Error: junk `@16' after expression
./ccCUbaaa.s:457: Error: junk `@0' after expression
./ccCUbaaa.s:468: Error: junk `@16' after expression
./ccCUbaaa.s:470: Error: junk `@0' after expression
./ccCUbaaa.s:481: Error: junk `@16' after expression
./ccCUbaaa.s:483: Error: junk `@0' after expression
./ccCUbaaa.s:511: Error: junk `@8' after expression
./ccCUbaaa.s:517: Error: junk `@8' after expression
./ccCUbaaa.s:520: Error: junk `@4' after expression
./ccCUbaaa.s:523: Error: junk `@4' after expression
./ccCUbaaa.s:527: Error: junk `@4' after expression
./ccCUbaaa.s:530: Error: junk `@4' after expression
./ccCUbaaa.s:533: Error: junk `@4' after expression
./ccCUbaaa.s:536: Error: junk `@4' after expression
./ccCUbaaa.s:538: Error: junk `@0' after expression
./ccCUbaaa.s:542: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:543: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:544: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:545: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:546: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:547: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:548: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:549: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:550: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:551: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:552: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:553: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:554: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:555: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:556: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:557: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:558: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:559: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:560: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:561: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:562: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:563: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:564: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:565: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:566: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:567: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:568: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:569: Error: junk at end of line, first unrecognized character is `@'
./ccCUbaaa.s:571: Error: junk at end of line, first unrecognized character is `@'
The code I compiled:
/**************************************************
** Programmer: Aaron Cardona
** File: testgl.cpp
** Last Modi: 20 Mar 2008
** Description: Displays a ball. It's awesome.
**************************************************/
#include<windows.h>
#include<GL/gl.h>
#include<GL/glut.h>
void init(void)
{
// define light properties
GLfloat mat_specular[]= {1.0, 1.0, 1.0, 1.0};
GLfloat mat_shininess[]= {5.0};
GLfloat light_position0[]= {1.0, 0.0, 0.0, 1.0};
GLfloat light_position1[]= {0.0, 1.0, 0.0, 1.0};
GLfloat light_position2[]= {0.0, 0.0, 1.0, 1.0};
GLfloat white_light[]= {1.0, 1.0, 1.0, 1.0};
GLfloat red_light[]= {1.0, 0.0, 0.0, 1.0};
GLfloat green_light[]= {0.0, 1.0, 0.0, 1.0};
GLfloat blue_light[]= {0.0, 0.0, 1.0, 0.0};
GLfloat orange_light[]={1.0,0.5, 0.0, 1.0};
GLfloat lmodel_ambient[]= {0.1, 0.1, 0.1, 0.1, 1.0};
glShadeModel(GL_SMOOTH);
glClearColor(0.0, 0.0, 0.0, 1.0);
// define material
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
// set up light0
glLightfv(GL_LIGHT0, GL_POSITION, light_position0);
glLightfv(GL_LIGHT0, GL_DIFFUSE, orange_light);
glLightfv(GL_LIGHT0, GL_SPECULAR, orange_light);
// set up light1
glLightfv(GL_LIGHT1, GL_POSITION, light_position1);
glLightfv(GL_LIGHT1, GL_DIFFUSE, green_light);
glLightfv(GL_LIGHT1, GL_SPECULAR, green_light);
// set up light2
glLightfv(GL_LIGHT2, GL_POSITION, light_position2);
glLightfv(GL_LIGHT2, GL_DIFFUSE, blue_light);
glLightfv(GL_LIGHT2, GL_SPECULAR, blue_light);
// set up light model
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
// glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
// enable lighting and depth testing
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
// enable the lights
glEnable(GL_LIGHT0);
// glEnable(GL_LIGHT1);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glutSolidSphere(1.0,16,16);
// glutSolidCube(1.0);
// glEnable(GL_LIGHT0);
glutSwapBuffers();
}
void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei)w, (GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(30, (GLfloat)w/(GLfloat)h, 1.0, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);
}
void keyboard(unsigned char key, int x, int y)
{
switch(key){
case 'i': // reset
case 'I':
glLoadIdentity();
gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);
glutPostRedisplay();
break;
case 'p':
case 'P':
glutFullScreen();
break;
case 'o':
case 'O':
glutReshapeWindow(640,480);
glutPositionWindow(100,100);
break;
case 27:
exit(0);
break;
default:
break;
}
}
void arrow_keys(int a_keys, int x, int y) // Create Special Function (required for arrow keys)
{
switch (a_keys){
case GLUT_KEY_UP:
glRotatef(-15.0,1.0,0.0,0.0);
glutPostRedisplay();
break;
case GLUT_KEY_DOWN:
glRotatef(15.0,1.0,0.0,0.0);
glutPostRedisplay();
break;
case GLUT_KEY_RIGHT:
glRotatef(15.0,0.0,1.0,0.0);
glutPostRedisplay();
break;
case GLUT_KEY_LEFT:
glRotatef(-15.0,0.0,1.0,0.0);
glutPostRedisplay();
break;
default:
break;
}
}
int main(int argc, char **argv)
{
glutInitWindowSize(640, 480);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
glutCreateWindow("Just A Basic Sphere");
init();
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutSpecialFunc(arrow_keys);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}