![]() |
| | #1 |
| Registered User Join Date: Jun 2006
Posts: 47
| C OpenGL Compiler Error? Recently I've been trying to compile some code with OpenGL with Dev-C++ 4. Dev-C++ can compile C, so I don't get it. I'm using GLUT.h, so that's the thing that is making it all messed up. When I compile anything, even using the test source code they give you, I get something like this: Code: C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x40e):spacem~1.c: undefined reference to `glutGet' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x436):spacem~1.c: undefined reference to `_imp__glBegin' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x450):spacem~1.c: undefined reference to `_imp__glColor3f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x4d3):spacem~1.c: undefined reference to `_imp__glVertex2f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x4e6):spacem~1.c: undefined reference to `_imp__glEnd' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x539):spacem~1.c: undefined reference to `_imp__glPushMatrix' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x55e):spacem~1.c: undefined reference to `_imp__glTranslatef' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x57b):spacem~1.c: undefined reference to `_imp__glRotatef' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x59f):spacem~1.c: undefined reference to `_imp__glColor3f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x5af):spacem~1.c: undefined reference to `_imp__glBegin' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x5d5):spacem~1.c: undefined reference to `_imp__glVertex2f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x5f1):spacem~1.c: undefined reference to `_imp__glVertex2f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x617):spacem~1.c: undefined reference to `_imp__glVertex2f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x622):spacem~1.c: undefined reference to `_imp__glEnd' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x639):spacem~1.c: undefined reference to `_imp__glColor3f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x649):spacem~1.c: undefined reference to `_imp__glBegin' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x665):spacem~1.c: undefined reference to `_imp__glVertex2f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x68b):spacem~1.c: undefined reference to `_imp__glVertex2f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x6a7):spacem~1.c: undefined reference to `_imp__glVertex2f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x6c6):spacem~1.c: undefined reference to `_imp__glVertex2f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x6e2):spacem~1.c: undefined reference to `_imp__glVertex2f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x6ed):spacem~1.c: undefined reference to `_imp__glEnd' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x722):spacem~1.c: undefined reference to `_imp__glColor3f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x732):spacem~1.c: undefined reference to `_imp__glBegin' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x7e0):spacem~1.c: undefined reference to `_imp__glVertex2f' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x7fa):spacem~1.c: undefined reference to `_imp__glEnd' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x802):spacem~1.c: undefined reference to `_imp__glPopMatrix' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x821):spacem~1.c: undefined reference to `_imp__glClear' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x847):spacem~1.c: undefined reference to `glutSwapBuffers' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x887):spacem~1.c: undefined reference to `glutGet' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xac3):spacem~1.c: undefined reference to `glutPostWindowRedisplay' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xaea):spacem~1.c: undefined reference to `glutIdleFunc' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xaf9):spacem~1.c: undefined reference to `glutIdleFunc' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xcf5):spacem~1.c: undefined reference to `glutGet' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xd47):spacem~1.c: undefined reference to `glutSetCursor' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xd8d):spacem~1.c: undefined reference to `glutGameModeString' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xd95):spacem~1.c: undefined reference to `glutEnterGameMode' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xdac):spacem~1.c: undefined reference to `glutGameModeString' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xdb4):spacem~1.c: undefined reference to `glutEnterGameMode' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xdd7):spacem~1.c: undefined reference to `glutLeaveGameMode' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xe09):spacem~1.c: undefined reference to `glutIdleFunc' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xe1b):spacem~1.c: undefined reference to `glutIdleFunc' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xee6):spacem~1.c: undefined reference to `_imp__glBlendFunc' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xef9):spacem~1.c: undefined reference to `_imp__glEnable' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xf0c):spacem~1.c: undefined reference to `_imp__glEnable' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xf1f):spacem~1.c: undefined reference to `_imp__glEnable' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xf3a):spacem~1.c: undefined reference to `_imp__glDisable' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xf4d):spacem~1.c: undefined reference to `_imp__glDisable' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xf60):spacem~1.c: undefined reference to `_imp__glDisable' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xf83):spacem~1.c: undefined reference to `glutGet' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xfa6):spacem~1.c: undefined reference to `glutGet' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0xfc9):spacem~1.c: undefined reference to `glutGet' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x1057):spacem~1.c: undefined reference to `glutGet' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x10f9):spacem~1.c: undefined reference to `glutGet' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x114c):spacem~1.c: more undefined references to `glutGet' follow C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x11a1):spacem~1.c: undefined reference to `glutIgnoreKeyRepeat' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x11b1):spacem~1.c: undefined reference to `glutDisplayFunc' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x11c1):spacem~1.c: undefined reference to `glutVisibilityFunc' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x11d1):spacem~1.c: undefined reference to `glutKeyboardFunc' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x11e1):spacem~1.c: undefined reference to `glutKeyboardUpFunc' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x11f1):spacem~1.c: undefined reference to `glutSpecialFunc' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x1201):spacem~1.c: undefined reference to `glutSpecialUpFunc' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x1213):spacem~1.c: undefined reference to `glutJoystickFunc' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x1224):spacem~1.c: undefined reference to `_imp__glMatrixMode' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x122f):spacem~1.c: undefined reference to `_imp__glLoadIdentity' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x1267):spacem~1.c: undefined reference to `_imp__glOrtho' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x127a):spacem~1.c: undefined reference to `_imp__glMatrixMode' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x1294):spacem~1.c: undefined reference to `_imp__glPointSize' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x129e):spacem~1.c: undefined reference to `glutGetWindow' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x12db):spacem~1.c: undefined reference to `glutInit' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x12e8):spacem~1.c: undefined reference to `glutInitDisplayMode' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x131d):spacem~1.c: undefined reference to `glutGameModeString' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x1325):spacem~1.c: undefined reference to `glutEnterGameMode' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x1339):spacem~1.c: undefined reference to `glutCreateWindow' C:\DOCUME~1\MATTMI~1\LOCALS~1\Temp\ccOcbaaa.o(.text+0x134d):spacem~1.c: undefined reference to `glutMainLoop' ~Matt3000 |
| Matt3000 is offline | |
| | #2 |
| Gawking at stupidity Join Date: Jul 2004
Posts: 2,324
| Looks like you're not including the library. Go to: Project -> Project Options, Parameter tab, click the Add Library or Object button.
__________________ If you understand what you're doing, you're not learning anything. Ignore any "advice" esbo tries to give you. It's wrong. |
| itsme86 is offline | |
| | #3 |
| Registered User Join Date: Jun 2006
Posts: 47
| Still Problems! Okay. Now I did that, and it won't let me run the program! It compiles 100% with no errors, but the "RUN" button is inactive, and where the file is in C:\, there is no .exe! Here is the exact code I use! Code: /* Copyright (c) Mark J. Kilgard, 1994. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h>
int ch = -2;
void *font = GLUT_STROKE_ROMAN;
void
tick(void)
{
ch += 1;
if (ch > 180) {
if (font == GLUT_STROKE_MONO_ROMAN) {
printf("PASS: test4\n");
exit(0);
}
ch = -2;
font = GLUT_STROKE_MONO_ROMAN;
}
glutPostRedisplay();
}
void
display(void)
{
glutIdleFunc(tick);
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glutStrokeCharacter(font, ch);
glPopMatrix();
glutSwapBuffers();
}
int
main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(200, 200);
glutCreateWindow("Test stroke fonts");
if (glutGet(GLUT_WINDOW_COLORMAP_SIZE) != 0) {
printf("FAIL: bad RGBA colormap size\n");
exit(1);
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-50, 150, -50, 150);
glClearColor(0.0, 0.0, 0.0, 1.0);
glColor3f(1.0, 1.0, 1.0);
glutDisplayFunc(display);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}
Last edited by Matt3000; 06-27-2006 at 06:44 PM. |
| Matt3000 is offline | |
| | #4 |
| Gawking at stupidity Join Date: Jul 2004
Posts: 2,324
| If the Run button is inactive that usually means the program is already running. Check Task Manager and make sure it's not listed under Processes. If it is, kill it. The .exe file for projects usually goes in C:\Dev-Cpp (or wherever you installed it) and the .c files go in the Templates subfolder.
__________________ If you understand what you're doing, you're not learning anything. Ignore any "advice" esbo tries to give you. It's wrong. |
| itsme86 is offline | |
| | #5 |
| Registered User Join Date: Jun 2006
Posts: 47
| Still Probs Hey. Thanks for the help so far, but I still need more! It's the LIB files. In the project options section, I've put this: Code: -lopengl32 -lglu32 -lglut32 Code: c:\space_magus.o(.text+0x65):space_magus.c: undefined reference to `glutPostRedisplay' c:\space_magus.o(.text+0x7c):space_magus.c: undefined reference to `glutIdleFunc' c:\space_magus.o(.text+0x8d):space_magus.c: undefined reference to `_imp__glClear' c:\space_magus.o(.text+0x98):space_magus.c: undefined reference to `_imp__glPushMatrix' c:\space_magus.o(.text+0xae):space_magus.c: undefined reference to `glutStrokeCharacter' c:\space_magus.o(.text+0xb7):space_magus.c: undefined reference to `_imp__glPopMatrix' c:\space_magus.o(.text+0xbe):space_magus.c: undefined reference to `glutSwapBuffers' c:\space_magus.o(.text+0x120):space_magus.c: undefined reference to `glutInit' c:\space_magus.o(.text+0x12d):space_magus.c: undefined reference to `glutInitDisplayMode' c:\space_magus.o(.text+0x142):space_magus.c: undefined reference to `glutInitWindowSize' c:\space_magus.o(.text+0x152):space_magus.c: undefined reference to `glutCreateWindow' c:\space_magus.o(.text+0x15f):space_magus.c: undefined reference to `glutGet' c:\space_magus.o(.text+0x19a):space_magus.c: undefined reference to `_imp__glMatrixMode' c:\space_magus.o(.text+0x1a5):space_magus.c: undefined reference to `_imp__glLoadIdentity' c:\space_magus.o(.text+0x1dc):space_magus.c: undefined reference to `gluOrtho2D' c:\space_magus.o(.text+0x1f0):space_magus.c: undefined reference to `_imp__glClearColor' c:\space_magus.o(.text+0x20d):space_magus.c: undefined reference to `_imp__glColor3f' c:\space_magus.o(.text+0x21f):space_magus.c: undefined reference to `glutDisplayFunc' c:\space_magus.o(.text+0x227):space_magus.c: undefined reference to `glutMainLoop' Last edited by Matt3000; 06-27-2006 at 08:48 PM. Reason: New Info |
| Matt3000 is offline | |
| | #6 |
| Registered User Join Date: Apr 2004
Posts: 41
| I use -lglut32 If you have just glut, use -lglut Is that what you wanted? Last edited by Link_26; 06-27-2006 at 08:48 PM. |
| Link_26 is offline | |
| | #7 |
| Registered User Join Date: Jun 2006
Posts: 47
| Nope, still get the same errors. :-( But I hear something on the internet about a DevPack GLUT? I just downloaded it from an OpenGL site. Is there a certain Dev-C++ version I should use? Last edited by Matt3000; 06-27-2006 at 08:52 PM. |
| Matt3000 is offline | |
| | #8 |
| Registered User Join Date: Apr 2004
Posts: 41
| In your source file, you didn't include the opengl header. Without it, i get a bunch of errors too, but with it, your code compiles. #include <gl/gl.h> That work? |
| Link_26 is offline | |
| | #9 | |
| Gawking at stupidity Join Date: Jul 2004
Posts: 2,324
| Quote:
__________________ If you understand what you're doing, you're not learning anything. Ignore any "advice" esbo tries to give you. It's wrong. | |
| itsme86 is offline | |
| | #10 |
| Registered User Join Date: Jun 2006
Posts: 47
| No, that gives me more errors. I think those includes are already in the Glut.h file. I think there is a DevPak I'm supposed to download. |
| Matt3000 is offline | |
| | #11 |
| Registered User Join Date: Jul 2006
Posts: 2
| Same problem. I have downloaded the OpenGL devpacks through the tools->check for updates/packages I still get whacked errors like this: A3.o(.text+0xc0e): In function `Z4idlev': C:/.../A3.c:280: undefined reference to `glutGet' A3.o(.text+0xdb0): C:/.../A3.c:314: undefined reference to `glutPostRedisplay' A3.o(.text+0x1002): In function `Z7displayv': C:/.../A3.c:368: undefined reference to `glutSwapBuffers' I have been trying to figure this out for weeks... I originally wrote the code in linux, actually, but that shouldnt matter with c++, and i have gotten regular glu programs to work, just not glut or glui ones |
| Scorpius is offline | |
| | #12 |
| Frequently Quite Prolix Join Date: Apr 2005 Location: Canada
Posts: 7,698
| Those are linker errors. You're not linking with what you should be. Make sure those library files exist, and see if there are any others you need to add.
__________________ dwk Seek and ye shall find. quaere et invenies. "Simplicity does not precede complexity, but follows it." -- Alan Perlis "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra "The only real mistake is the one from which we learn nothing." -- John Powell Other boards: DaniWeb, TPS Unofficial Wiki FAQ: cpwiki.sf.net My website: http://dwks.theprogrammingsite.com/ Projects: codeform, xuni, atlantis, nort, etc. |
| dwks is offline | |
| | #13 | |
| Registered User Join Date: Jul 2006
Posts: 2
| Quote:
Well i got it to work. The truth is that the above libraries must be linked in the REVERSE ORDER... contradictory to EVERY SOURCE i've found on the matter... maybe it's just this version of DEV-C++... whacked in your project options->parameters set it to this: Code: -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 hooray! Last edited by Scorpius; 07-07-2006 at 04:51 PM. | |
| Scorpius is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting an error with OpenGL: collect2: ld returned 1 exit status | Lorgon Jortle | C++ Programming | 6 | 05-08-2009 08:18 PM |
| Making C DLL using MSVC++ 2005 | chico1st | C Programming | 26 | 05-28-2008 01:17 PM |
| load gif into program | willc0de4food | Windows Programming | 14 | 01-11-2006 10:43 AM |
| Dikumud | maxorator | C++ Programming | 1 | 10-01-2005 06:39 AM |
| Linking error | DockyD | C++ Programming | 10 | 01-20-2003 05:27 AM |