-
OpenGL in devc++
Hello.
I am one litle newb that tryes to learn opengl!
This, however is not easy when i get 21 errors:
[Linker error] undefined reference to `ChoosePixelFormat@8'
[Linker error] undefined reference to `SetPixelFormat@12'
[Linker error] undefined reference to `glViewport@16'
[Linker error] undefined reference to `glMatrixMode@4'
[Linker error] undefined reference to `glLoadIdentity@0'
[Linker error] undefined reference to `gluPerspective@32'
[Linker error] undefined reference to `glMatrixMode@4'
[Linker error] undefined reference to `glLoadIdentity@0'
[Linker error] undefined reference to `wglCreateContext@4'
[Linker error] undefined reference to `wglMakeCurrent@8'
[Linker error] undefined reference to `glClear@4'
[Linker error] undefined reference to `glLoadIdentity@0'
[Linker error] undefined reference to `gluLookAt@72'
[Linker error] undefined reference to `glBegin@4'
[Linker error] undefined reference to `glVertex3f@12'
[Linker error] undefined reference to `glVertex3f@12'
[Linker error] undefined reference to `glVertex3f@12'
[Linker error] undefined reference to `glEnd@0'
[Linker error] undefined reference to `SwapBuffers@4'
[Linker error] undefined reference to `wglMakeCurrent@8'
[Linker error] undefined reference to `wglDeleteContext@4'
Does it have something to do with the folowing lines:
"
#pragma comment(lib, "libopengl32.lib")
#pragma comment(lib, "libglu32.lib")
"
if it helps here are my path to the lib folder:
"C:\Dev-Cpp\lib"
-
Are you sure you included all the header files, those errors seem like they could be related to that. Then again, I'm a newbie also, so I could be wrong. :p
-
That pragma relates to VC++...not devc++...link in those libs manually
-
-
I'm a newbie and I had exactly the same problem some minutes ago while trying to compile the Open GL tutorial source code.
I still have no clue why exactly this error occurs, but I found a way to get around it. I opened the OpenGL application template in Dev C++ and then pasted the tutorial source code again. It (almost) worked now.
So it has to do something with the project settings. I checked this (Project/Project settings) and found this entry under the "Parameters" tab: -lopengl32
Seems like some parameter to link a library. However there is no library called lopengl32, so I don't exactly understand it. Anyway. The number of error messages decreased a lot and only "glu..." errors remained so I "added" the glu32 library. Funny thing is, this lib gets added with full path and without the - in front of the parameter.
Anyway, The tutorial compiled. No clue why or how, but it seems to work. I was just about to create a post about this because I'd like to understand why these options are needed. Maybe somebody could answer my question in this post. Seems to be on topic.
Hope that helps.
-
thank you darksaidin
Finaly i figured it out!
You don't need these lines
#pragma comment(lib, "libopengl32.lib")
#pragma comment(lib, "libglu32.lib")
because you should have them in the \project\project options\parameters rollout to get the project to work.