Advertisement

redeclaration of C++ built-in type

Started by July 28, 2004 01:15 AM
33 comments, last by Kylotan 7 years, 6 months ago
O M F G AHAHAHAHAH YYYEEESSSS AHAHAHAHAH I DID IT THANK U ALL THANK U SO F*ING MUCH!!!!!!!!!!

In dev c++ the actual lib name is "libfreeglut.a" or what ever but it's prefaced with "lib" which u do NOT INCLUDE in the command line linker!! AHAHAH YYEESSSS!!!!!!!!!! 04:13 lets see i started this at what... 21:00 last nite? oohhh ya...

Well my Open GL learning can commence after some HALO fragging thank you all so dearly for helping me through this you guys rock!
==============================
A Developers Blog | Dark Rock Studios - My Site
well i got the templates compiling fine but the fucking sample code from the book is still fucked.... jesus christ it just never ends...

Well this time all the Linking errors are for gl and glu... atleast glut is fixed it seems.

Any ideas on where to get good versionf of the gl and glu headers and libs?
==============================
A Developers Blog | Dark Rock Studios - My Site
Advertisement
Well I downloaded a VC++ 2005 beta and compiled the sample code in there and it works (2 warnings but... it works.) I really don't like VC++ its huge, tons more to learn if I'm gonna use it for this entire open gl book.

But it works... I think I'm gonna call it a nite... get some sleep b4 i continue... thanks fo your help everyone.
==============================
A Developers Blog | Dark Rock Studios - My Site
Quote:


  • Offensive language should be avoided.



Forum FAQ
Ok I reinstalled my compiler's headers and libs and recompiled and still get my errors... Heres the log:

Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Dev-Cpp\my code\openGL\my code\Chapter01\Simple.cpp" -o "C:\Dev-Cpp\my code\openGL\my code\Chapter01\Simple.exe" -mwindows -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -lopengl32 -lglu32 -lglut32
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x18f):Simple.cpp: undefined reference to `_imp__glEnable'

C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x22d):Simple.cpp: undefined reference to `_imp__glViewport'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x23f):Simple.cpp: undefined reference to `_imp__glMatrixMode'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x249):Simple.cpp: undefined reference to `_imp__glLoadIdentity'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x27d):Simple.cpp: undefined reference to `_imp__gluPerspective'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x28f):Simple.cpp: undefined reference to `_imp__glMatrixMode'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x2a1):Simple.cpp: undefined reference to `_imp__glLoadIdentity'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x2d8):Simple.cpp: undefined reference to `_imp__gluLookAt'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x2ea):Simple.cpp: undefined reference to `_imp__glClear'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x2f9):Simple.cpp: undefined reference to `_imp__glBegin'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x30f):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x32b):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x341):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x35d):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x373):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x38c):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x396):Simple.cpp: undefined reference to `_imp__glEnd'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x3a2):Simple.cpp: undefined reference to `_imp__glBegin'

C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x3be):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x3d7):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x3f0):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x409):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x422):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x43b):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x44e):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x467):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x480):Simple.cpp: undefined reference to `_imp__glColor3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x499):Simple.cpp: undefined reference to `_imp__glVertex3f'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/cckjaaaa.o(.text+0x4a3):Simple.cpp: undefined reference to `_imp__glEnd'
C:\Dev-Cpp\lib/libglut32.a(glut_swap.o)(.text+0x71):glut_swap.c: undefined reference to `wglSwapBuffers@4'
C:\Dev-Cpp\lib/libglut32.a(glut_event.o)(.text+0x319):glut_event.c: undefined reference to `glFinish@0'
C:\Dev-Cpp\lib/libglut32.a(glut_event.o)(.text+0x374):glut_event.c: undefined reference to `wglSwapBuffers@4'

C:\Dev-Cpp\lib/libglut32.a(glut_event.o)(.text+0x3dc):glut_event.c: undefined reference to `wglSwapBuffers@4'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x18f):glut_win.c: undefined reference to `wglGetCurrentContext@0'

C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x196):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x1b6):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x1d5):glut_win.c: undefined reference to `glViewport@16'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x1f7):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x216):glut_win.c: undefined reference to `glViewport@16'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x21e):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x225):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x241):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x843):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x84a):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x866):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x897):glut_win.c: undefined reference to `glDrawBuffer@4'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0x8a6):glut_win.c: undefined reference to `glReadBuffer@4'

C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xaa1):glut_win.c: undefined reference to `wglDeleteContext@4'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xb61):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xbd2):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xbd9):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xbf5):glut_win.c: undefined reference to `wglMakeCurrent@8'

C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xcb4):glut_win.c: undefined reference to `wglGetCurrentContext@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xcbb):glut_win.c: undefined reference to `wglGetCurrentDC@0'
C:\Dev-Cpp\lib/libglut32.a(glut_win.o)(.text+0xcd7):glut_win.c: undefined reference to `wglMakeCurrent@8'
C:\Dev-Cpp\lib/libglut32.a(glut_mesa.o)(.text+0x80):glut_mesa.c: undefined reference to `glGetString@4'
C:\Dev-Cpp\lib/libglut32.a(glut_mesa.o)(.text+0x91):glut_mesa.c: undefined reference to `glGetString@4'
C:\Dev-Cpp\lib/libglut32.a(glut_util.o)(.text+0x281):glut_util.c: undefined reference to `glGetError@0'
C:\Dev-Cpp\lib/libglut32.a(glut_util.o)(.text+0x28d):glut_util.c: undefined reference to `gluErrorString@4'

C:\Dev-Cpp\lib/libglut32.a(win32_glx.o)(.text+0x30d):win32_glx.c: undefined reference to `wglCreateContext@4'
C:\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x292):win32_winproc.c: undefined reference to `joyReleaseCapture@4'
C:\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x3fc):win32_winproc.c: undefined reference to `joySetCapture@16'
C:\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x162f):win32_winproc.c: undefined reference to `joyGetPosEx@8'
C:\Dev-Cpp\lib/libglut32.a(win32_winproc.o)(.text+0x171f):win32_winproc.c: undefined reference to `joyGetPosEx@8'

Execution terminated


Any ideas? any one?
==============================
A Developers Blog | Dark Rock Studios - My Site
I've got a few options here...
For headers I have:
glut.h
freeglut.h

These are the ones I have been working with.
Then I have these libs:

libglut.a
libglut32.a
libfreeglut.a

When I include freeglut.h and link to libfreeglut.a I get the fewest linking errors.

Now I also have several header files that give me wierd syntax errors:

fglut.h
freeglut_std.h
freeglut_ext.h
glutf90.h

All these just give me strange errors.

Well any way with calling freeglut.h and linking to: -lopengl32 -lglu32 -lfreeglut

I get this compile log. Much shorter but... Still no moss...

Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Dev-Cpp\my code\openGL\my code\Chapter01\Simple.cpp" -o "C:\Dev-Cpp\my code\openGL\my code\Chapter01\Simple.exe" -mwindows -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -lopengl32 -lglu32 -lfreeglut
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x3b):Simple.cpp: undefined reference to `_imp__glutInit@8'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x4a):Simple.cpp: undefined reference to `_imp__glutInitDisplayMode@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x61):Simple.cpp: undefined reference to `_imp__glutInitWindowSize@8'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x75):Simple.cpp: undefined reference to `_imp__glutInitWindowPosition@8'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x87):Simple.cpp: undefined reference to `_imp__glutCreateWindow@4'

C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x9e):Simple.cpp: undefined reference to `_imp__glutDisplayFunc@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0xb0):Simple.cpp: undefined reference to `_imp__glutReshapeFunc@4'

C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0xc2):Simple.cpp: undefined reference to `_imp__glutMouseFunc@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0xd4):Simple.cpp: undefined reference to `_imp__glutKeyboardFunc@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0xe6):Simple.cpp: undefined reference to `_imp__glutIdleFunc@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0xf0):Simple.cpp: undefined reference to `_imp__glutMainLoop@0'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x111):Simple.cpp: undefined reference to `_imp__glutCreateMenu@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x124):Simple.cpp: undefined reference to `_imp__glutSetMenu@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x138):Simple.cpp: undefined reference to `_imp__glutAddMenuEntry@8'

C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x147):Simple.cpp: undefined reference to `_imp__glutAttachMenu@4'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x17c):Simple.cpp: undefined reference to `_imp__glutPostRedisplay@0'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x1aa):Simple.cpp: undefined reference to `_imp__glutPostRedisplay@0'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x1cc):Simple.cpp: undefined reference to `_imp__glutPostRedisplay@0'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x1db):Simple.cpp: undefined reference to `_imp__glutPostRedisplay@0'
C:\DOCUME~1\ADAMBR~1\LOCALS~1\Temp/ccaAbaaa.o(.text+0x43c):Simple.cpp: undefined reference to `_imp__glutSwapBuffers@0'

Execution terminated
==============================
A Developers Blog | Dark Rock Studios - My Site
Advertisement
OMFG!!! BREAK THROUGH!!! look look look!!!

If I link:
-lopengl32 -lglu32 -lfreeglut -lglut

Notice -lfreeglut AND -lglut THEN IT COMPILES!!!! Only problem is just glut is a older file and it wants opengl.dll to run my finaly exe and I only have opengl32.dll... So i'm looking for opengl.dll if any one has it or knows where I can get it please tell me.
==============================
A Developers Blog | Dark Rock Studios - My Site
Nope nope nope...

Well I got the dll i needed then it needed another dll and another and another and it just went on and on till finaly it gave me some error about my entry point... So f* it just f* it...

Here's what I'm gonna do. I'll post the source of the file I'm trying to compile and if any one has it in their heart to see if they can compile it, and they do and it works. Tell me how lol...

I still am calling the freeglut header, change it to what ever glut you have. Also I'm calling the std lib b/c with out it I get an error calling the exit(); function but this include wansn't in the original code so feel free to take it out. Besides that it's all exactly the same as what was in the book (strait from the book's CD actualy)

#include <gl\freeglut.h>#include <cstdlib>void Initialize();void MouseHandler(int button, int state, int x, int y);void KeyboardHandler(unsigned char key, int x, int y);void MainMenuHandler(int option);void Animate();void Reshape(int width, int height);void Display();/**************************************************************************** main() Setup GLUT and OpenGL, drop into the event loop*****************************************************************************/int main(int argc, char **argv){  // Setup the basic GLUT stuff  glutInit(&argc, argv);  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);  // Create the window  glutInitWindowSize(1024, 768);  glutInitWindowPosition(100, 150);  glutCreateWindow("BOGLGP Chapter 1");  Initialize();  // Register the event callback functions  glutDisplayFunc(Display);   glutReshapeFunc(Reshape);  glutMouseFunc(MouseHandler);  glutKeyboardFunc(KeyboardHandler);  glutIdleFunc(Animate);  // At this point, control is relinquished to the GLUT event handler.  // Control is returned as events occur, via the callback functions.  glutMainLoop();        return 0;} // end main()/**************************************************************************** Initialize() One time setup, including creating menus, creating a light, setting the shading mode and clear color, and loading textures.*****************************************************************************/void Initialize(){  // set up the only meny  int mainMenu;  mainMenu = glutCreateMenu(MainMenuHandler);  glutSetMenu(mainMenu);  glutAddMenuEntry("Exit", 0);  glutAttachMenu(GLUT_RIGHT_BUTTON);  glEnable(GL_DEPTH_TEST);} // end Initialize()/**************************************************************************** MouseHandler()  Handle mouse events. For this simple demo, just exit on a left click.*****************************************************************************/void MouseHandler(int button, int state, int x, int y){  switch (button)  {  case GLUT_LEFT_BUTTON:    {      exit(0);    } break;  default:    break;  }  // force a screen redraw  glutPostRedisplay();} // end MouseHandler()/**************************************************************************** KeyboardHandler() Keyboard handler. Again, we'll just exit when q is pressed.*****************************************************************************/void KeyboardHandler(unsigned char key, int x, int y){  switch (key)  {  case 'q':  // exit    {      exit(0);    } break;  default:    {    } break;  }  glutPostRedisplay();} // end KeyboardHandler()/**************************************************************************** MainMenuHandler() Main menu callback.*****************************************************************************/void MainMenuHandler(int option){  switch(option)  {  case 0:    {      exit(0);    } break;  default:    break;  }  glutPostRedisplay();} // end MainMenuHandler()/**************************************************************************** Animate() Rotate the cube by 4 degrees and force a redisplay.*****************************************************************************/void Animate(){  glutPostRedisplay();} // end Animate()/**************************************************************************** Reshape() Reset the viewport for window changes*****************************************************************************/void Reshape(int width, int height){  if (height == 0)    return;  glViewport(0, 0, (GLsizei) width, (GLsizei) height);  glMatrixMode(GL_PROJECTION);  glLoadIdentity();  gluPerspective(90.0, width/height, 1.0, 100.0);  glMatrixMode(GL_MODELVIEW);} // end Reshape/**************************************************************************** Display() Clear and redraw the scene.*****************************************************************************/void Display(){  // set up the camera  glLoadIdentity();  gluLookAt(0.0, 1.0, 6.0,            0.0, 0.0, 0.0,            0.0, 1.0, 0.0);  // clear the screen  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  // draw a triangle  glBegin(GL_TRIANGLES);    glColor3f(1.0, 0.0, 0.0);    glVertex3f(2.0, 2.5, -1.0);    glColor3f(0.0, 1.0, 0.0);    glVertex3f(-3.5, -2.5, -1.0);    glColor3f(0.0, 0.0, 1.0);    glVertex3f(2.0, -4.0, 0.0);  glEnd();  // draw a polygon  glBegin(GL_POLYGON);    glColor3f(1.0, 1.0, 1.0);    glVertex3f(-1.0, 2.0, 0.0);    glColor3f(1.0, 1.0, 0.0);    glVertex3f(-3.0, -0.5, 0.0);    glColor3f(0.0, 1.0, 1.0);    glVertex3f(-1.5, -3.0, 0.0);    glColor3f(0.0, 0.0, 0.0);    glVertex3f(1.0, -2.0, 0.0);    glColor3f(1.0, 0.0, 1.0);    glVertex3f(1.0, 1.0, 0.0);  glEnd();  // draw everything and swap the display buffer  glutSwapBuffers();} // end Display()


[Edited by - Fruny on July 28, 2004 5:57:52 PM]
==============================
A Developers Blog | Dark Rock Studios - My Site
Try -lfreeglut -glu32 -lopengl32. Library ordering does matter, with later libraries filling dependencies of earlier libraries (freeglut depends on opengl32 so you'd list it before opengl32).
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Nope :(

Tried all the lib and header combinations w\ this too.

I'm really out of ideas for this.

I'm using a beta version of MSVC++ 2005 which works i guess. I get 2 errors and have to convert everything to these clunky "projects" but it compiles and I can finaly learn OpenGL so... I guess MS wins out again...

Looks like I get the head ache of learning some huge new MS program while trying to learn OpenGL too, w00t.
==============================
A Developers Blog | Dark Rock Studios - My Site

This topic is closed to new replies.

Advertisement