MinGW assembler/linker error

Started by
17 comments, last by WaterMonkey314 16 years ago
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;
}

Advertisement
You seem to have a bad installation, try downloading the automated installer from SourceForge and try again.

Also remember to add c:\MinGW\bin to your PATH.
Would it also cause an issue if I have Dev-Cpp v4.9.9.2(w/ MinGW v3.4.3) installed on the same system?

Also, is it possible to retrofit the Dev-Cpp MinGW to compile OpenGL?

And yes, I have added put C:\MinGW\bin in my PATH.

Edit: By the way, the MinGW I tried to use is v3.4.5.
Quote:Original post by WaterMonkey314
Would it also cause an issue if I have Dev-Cpp v4.9.9.2(w/ MinGW v3.4.3) installed on the same system?

Also, is it possible to retrofit the Dev-Cpp MinGW to compile OpenGL?

And yes, I have added put C:\MinGW\bin in my PATH.

Edit: By the way, the MinGW I tried to use is v3.4.5.

Devcpp might be related to the issue indeed. Devcpp is considered to be outdated and not in active development anymore. My personal proposal is to uninstall it and try again after that.

Code::Blocks seems to be a better alternative to Devcpp if you would like to use the mingw compiler in combination with a fancy IDE on win32:
Code::Blocks - cross platform development IDE

-----PARPG - open source isometric 2d old school RPG still looking for interested contributors
That's sad Dev's discontinued - I liked it.

I'll try uninstalling it and MinGW, and then reinstalling just MinGW.

Oh, and I forgot I've also got DJGPP on the same system. :D On top of that, I think my XP system has MinGW, an old version of Dev, DJGPP, and Borland. Should I get rid of some of these also?

Thank you both for the help!
Quote:Original post by WaterMonkey314
Oh, and I forgot I've also got DJGPP on the same system. :D On top of that, I think my XP system has MinGW, an old version of Dev, DJGPP, and Borland. Should I get rid of some of these also?

Thank you both for the help!

It seems that djgpp is not related to mingw so no need to remove. I would uninstall all devcpp and mingw versions.

After that either download:
1. Code::Blocks with mingw (in case you would like to use an IDE)
2. MinGW installer (in case you would like to just use mingw directly from the command line)
-----PARPG - open source isometric 2d old school RPG still looking for interested contributors
Yuck...I uninstalled Dev-c++ and reinstalled MinGW, but I'm still having problems...

Is there a way to add MinGW to Code::Blocks without reinstalling it, too? (The current one seems to be perma-broken)
Sorry about the double post, but this is an important finding I made:

After redownloading and reinstalling MinGW (again) I'm still getting these assembler errors. However, if I don't put the OpenGL files where they're supposed to go, the assembler errors go away and are replaced by plain "not defined" errors. Unfortunately, I still can't get it to compile plain C++ code either. It still says it can't execute 'ld'.
DJGPP may create a conflict since its gcc as well, make sure the MinGW path is listed first in your PATH variable, if possible, remove the djgpp path, remove the cc1plus you copied from c:\MinGW\bin, (I don't have a copy of cc1plus on my c:\MinGW\bin directory), and finally on a command line window run "gcc --version" to make sure you have the right one, mine says:

Quote:
C:\MinGW\bin>gcc --version
gcc (GCC) 3.4.5 (mingw special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
My DJGPP path is in front of the MinGW one, but I've been using the g++ command.

I've also noticed some sort of version with a bugfix for Vista, so I'll try that. I'll report the results.

This topic is closed to new replies.

Advertisement