|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| dev cpp never success link with glut |
|
![]() yjh1982 Member since: 12/29/2003 |
||||
|
|
||||
| I down some opengl sample use dev cpp.but can't build. link error as: [Linker error] undefined reference to `_imp__glutSwapBuffers@0' ..... after a long time,I think this is because glut.but I use http://www.nigels.com/glt/devpak/ OpenGLUT GLUT 3.7.6 FreeGLUT all can't link success . can you help me ? |
||||
|
||||
![]() Drew_Benton GDNet+ Member since: 7/29/2004 From: Katy, TX, United States |
||||
|
|
||||
You should link with -lglut32. That's about it. If you get more linker errors for OpenGL use:-lglut32 -lglu32 -lopengl32 |
||||
|
||||
![]() yjh1982 Member since: 12/29/2003 |
||||
|
|
||||
Quote: question is:I alrealdy add -lglut32,-lglu32..and so on. and if use OpenGLUT I add -lopenglut use freeglut add -lfreeglut....link error is change ,but all like "[Linker error] undefined reference to..." |
||||
|
||||
![]() Drew_Benton GDNet+ Member since: 7/29/2004 From: Katy, TX, United States |
||||
|
|
||||
Can you post the errors/code that you are trying to compile. Please use the [source] [/source] tags so it comes out nice and neat . Alos you might want to take a look at this tutorial. It goes though the process step by step quite clearly. Do that before you post code. |
||||
|
||||
![]() yjh1982 Member since: 12/29/2003 |
||||
|
|
||||
| I try it.but can't success on http://www.cs.uofs.edu/~mpc3/cmps370/glutsetup.html sample:( glut32.def - Save this file to " C:/dev-c++/lib/ " .....can use *.def as lib link? I can't success on any glut sample project ....my dev cpp is 4.9.9.2 |
||||
|
||||
![]() Drew_Benton GDNet+ Member since: 7/29/2004 From: Katy, TX, United States |
||||
|
|
||||
| Ok let's go through this step by step. 1. Click here and download the Dev-CPP Devpack. After it is done you will need to find it and install it. 2. When you find it, you should be able to double click on it. A new window will popup with a title of "Installation Wizard". If that does not happen you will need to follow 2*. If it does, then go to step three. 2.* If you get to here, then the file did not auto open with Dev-CPP. Openup Dev-CPP. Click on "Tools" then "Package Manager". Now choose "Package" then "Install Package". Now you will need to navigate to where you saved the DevPak and select it. You should now see the image from Step 2. Proceed on to step 3 now. 3. Click "Install" then "Finish". Before you close the "Package Manager" window that comes up afterwards, check to make sure you can see the GLUT package. 4. Now you will need to open up Dev-CPP. Choose "File->New->Project". Type in a name for the project and select a "Console Application". Choose a place to save it at. 5. Now delete everything in the "main.cpp" file and copy and paste this code into it: #include <windows.h> #include <gl\gl.h> #include <gl\glut.h> void init(void); void display(void); int main(int argc, char *argv[]) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB); glutInitWindowSize(250,250); glutInitWindowPosition(100,200); glutCreateWindow("My First Glut/OpenGL Program"); init(); glutDisplayFunc(display); glutMainLoop(); return 0; } void init(void) { glClearColor(0.0f ,0.0f ,0.0f ,0.0f); glColor3f(0.0f,0.0f,1.0f); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f,(GLfloat)250/(GLfloat)250,0.1f,100.0f); } void display(void) { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_TRIANGLES); glVertex3f( 0.0f, 1.0f, -10.0f); glVertex3f(-1.0f,-1.0f, -10.0f); glVertex3f( 1.0f,-1.0f, -10.0f); glEnd(); glutSwapBuffers(); } 6. Now choose "Project" then "Project Options" and click on the "Parameters" tab. In the linker box type in this order: -lglut32 -lglu32 -lopengl32 -lglaux -lgdi32 -lwinmm 7. Now hit ok. Choose "Execute" then "Compile and Run", and you should see the program. If you have any questions/comments, feel free to ask. The project can be downloaded here as well. - Drew |
||||
|
||||
![]() yjh1982 Member since: 12/29/2003 |
||||
|
|
||||
| thanks Drew_Benton . your project is success. and use your link -lglut32 -lglu32 -lopengl32 -lglaux -lgdi32 -lwinmm replace my link -lopengl32 -lglu32 -lglut32 -lz(use zlib) -lGdi32 is success!why?because a return line,or winmm/glaux,or link order? |
||||
|
||||
![]() Drew_Benton GDNet+ Member since: 7/29/2004 From: Katy, TX, United States |
||||
|
|
||||
| No problem! I am not entirely sure what was happening with your project. I think your libaries might have gotten corrupted or something, I don't know really. The example that I used had to link in those libraries for some odd reason. Well glad it's working, have fun with GLUT. - Drew |
||||
|
||||
![]() MaulingMonkey Member since: 8/19/2002 From: Seattle, WA, United States |
||||
|
|
||||
Quote: I'm guessing link order. |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| i have a similar problem - i get the same linker errors. i have tried all the linker flags. i have checked - the libraries are there, the header files are there. i do EXACTLY what drew says. yet the errors do not go away. can someone help me? |
||||
|
||||
![]() Drew_Benton GDNet+ Member since: 7/29/2004 From: Katy, TX, United States |
||||
|
|
||||
| And I just took down the project files and screenshots, They have been reuploaded. So, see if you have missed anything, and if you still can't get it, we can work from there. Give the projecy a try out as well. - Drew |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| thanks drew. the error remains :( i do not know. i am giving up. you can take down the project. w. |
||||
|
||||
![]() Drew_Benton GDNet+ Member since: 7/29/2004 From: Katy, TX, United States |
||||
|
|
||||
| Well sorry to hear that! I don't know why that would be happening. I mean you could uninstall your Dev-CPP, get the 4.9.9.2 Beta version and give it another shot and see. I'll leave thet project up for anyone else who needs it. Good luck! |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|