# OpenGL openGL errors

## Recommended Posts

Darkware    122
When using the code you download here: http://nehe.gamedev.net/data/lessons/devc/lesson01.zip which uses openGL (lesson 1 code), why do I get the following errors when trying to run it? I'm using Dev-C++ compiler by the way. Also, for Dev-C++ you must #define CDS_FULLSCREEN because Dev-C++ isn't a compiler that already defines it. THIS define is NOT in the downloadable coding for some reason, so you'll have to put it in yourself. C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x38):lesson1.cpp: undefined reference to glViewport@16' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x45):lesson1.cpp: undefined reference to glMatrixMode@4' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x4d):lesson1.cpp: undefined reference to glLoadIdentity@0' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x84):lesson1.cpp: undefined reference to gluPerspective@32' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x91):lesson1.cpp: undefined reference to glMatrixMode@4' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x99):lesson1.cpp: undefined reference to glLoadIdentity@0' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0xb7):lesson1.cpp: undefined reference to glShadeModel@4' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0xd1):lesson1.cpp: undefined reference to glClearColor@16' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0xe0):lesson1.cpp: undefined reference to glClearDepth@8' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0xf0):lesson1.cpp: undefined reference to glEnable@4' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x100):lesson1.cpp: undefined reference to glDepthFunc@4' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x115):lesson1.cpp: undefined reference to glHint@8' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x13b):lesson1.cpp: undefined reference to glClear@4' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x143):lesson1.cpp: undefined reference to glLoadIdentity@0' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x258):lesson1.cpp: undefined reference to wglMakeCurrent@8' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x282):lesson1.cpp: undefined reference to wglDeleteContext@4' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x854):lesson1.cpp: undefined reference to ChoosePixelFormat@8' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x898):lesson1.cpp: undefined reference to SetPixelFormat@12' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x8ce):lesson1.cpp: undefined reference to wglCreateContext@4' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0x914):lesson1.cpp: undefined reference to wglMakeCurrent@8' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccETaaaa.o(.tex t+0xc2f):lesson1.cpp: undefined reference to SwapBuffers@4'

##### Share on other sites
Fruny    1658
Because you're not linking to the OpenGL libraries.

##### Share on other sites
FlyingDemon    112
link the correct opengl libraries ( *.a ), one of nehe's tutorials tells you wich ones.

##### Share on other sites
Drew_Benton    1861
I do not see why you are having problems. If you open the "Lesson1.dev" file, it has the correct libraries already in there:

-lopengl32 -lglu32 -lglaux -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32

All I had to do was comment out the line:
#include <gl\glaux.h>		// Header File For The Glaux Library`

And that worked for me fine. I just installed Dev-CPP as well, so I havce not made any chagnes to it. I also do not see how you are having troubles with "CDS_FULLSCREEN". In that tutorial they include windows.h, so it is defined already. Once again, I downloaded that link you posted and it compiled without any modifications except removing the glaux.

I'd say make sure you open the "Lesson1.dev" file with Dev-CPP and you should be fine. Make sure you are using the latest Dev-CPP as well. Good luck!

- Drew

##### Share on other sites
Darkware    122
ok, I have been researching this for hours. My brain feels like it's going to leak out of my ear.

I downloaded and unziped http://nehe.gamedev.net/data/lessons/devc/lesson01.zip then opened the project file. Under Project>ProjectOptions and in the "Further object files or linker options" place, there was nothing typed as you said. It was just blank. Also, no code appears to be visible at all either. I try to click on the lesson1.cpp link on the left where the manager colomn is, but nothing happens. I can only see code when I open the lesson1.cpp file specifically.

My way around this: Create a new project and copy/paste code into a new file, then save that project.

~~~~~~~~
NOW... this: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01 is the only tutorial or documentation on this website I can find that covers the installation of openGL. It does not specificy where to instal the lib, dll, or h files. I am completely new to this, so I don't know where these go. From my research, I have found that most of the documentations on installing openGL, mention the G++, include, and lib folders, so I just went and installed all the lib, dll, and h files to those locations. I also did not know how to "link" and what specifically NEEDED to be linked. I also found out that the dll files were supposed to go in your system32 folder. I now go to Project>ProjectOptions and under "Further object files or linker options" place, I type -lopengl32 -lglu32 -lglut32 and hit "OK".

Now when I compile, I just get errors like:
(.text+0x854):mycfilename.cpp: undefined reference to 'ChoosePixelFormat@8'
and whatnot. Just three of them though.

SOOOOOoooo..... I never would have guessed this to be this difficult. There are not very many documentations online that go over ALL installation setps for ALL of the files you get and tell you where EXACTLY you're supposed to place the files. This is slightly frustrating because I want to get to coding, not spend countless hours trying to figure out all this stuff my trial and error. But... hopefully I can just get through this soon to get it over with and all will be fine. =)

##### Share on other sites
Drew_Benton    1861
Quote:
 Original post by DarkwareI downloaded and unziped http://nehe.gamedev.net/data/lessons/devc/lesson01.zip then opened the project file. Under Project>ProjectOptions and in the "Further object files or linker options" place, there was nothing typed as you said. It was just blank. Also, no code appears to be visible at all either. I try to click on the lesson1.cpp link on the left where the manager colomn is, but nothing happens. I can only see code when I open the lesson1.cpp file specifically.

What the heck? How is that possible? Would you like me to send you the project I have? Maybe some freak occurance happened or something with your Dev-CPP...it is known for instability at times...Anyways, here is my project I downloaded and was able to run with no problems. Open it up and see if it works. If it does not, I would strongly suggest uninstalling your Dev-CPP and installing the newest one, even if you do have the most recent one. Good luck!

- Drew

Darkware    122

##### Share on other sites
Darkware    122
hey your file works.... what the heck.... why doesn't mine.... that's weird....

well... I'm going to try and figure out what exactly is going wrong here. If I figure it out, I'll post it back here.

##### Share on other sites
Guest Anonymous Poster
Quote:
 Original post by DarkwareSOOOOOoooo..... I never would have guessed this to be this difficult. There are not very many documentations online that go over ALL installation setps for ALL of the files you get and tell you where EXACTLY you're supposed to place the files. This is slightly frustrating because I want to get to coding, not spend countless hours trying to figure out all this stuff my trial and error. But... hopefully I can just get through this soon to get it over with and all will be fine. =)

You are putting horse before the cart. You must understand how to do all those steps before you can start CODING. None of that stuff is very hard and if you google enough you will get ALL the info you need, so get going and LEARN the "stuff"

##### Share on other sites
Drew_Benton    1861
Quote:
 Original post by Darkwarenow buy NEWEST do you mean the beta version? because I downloaded the one before that because I didn't want a beta

Ahh yes, the Beta! Not version 4. However, I am not a Dev-CPP user for the most part, so you might want to stay with what you are most comfortable with. I'm glad it works though! I can't figure out why it didn't in the first place either, but it *may* be that version of Dev, who knows.

- Drew

##### Share on other sites
Darkware    122

Question: how can the cpp file be the same name as the dev project file? I try to create a new project, then save the cpp file as the same name as the dev project, but it won't let me. How is this done?

Where do you get the MakeFile.win Lesson1.o Lesson1.layout and Lesson1.~cp files? Some of them are encrypted. I tested, and you apparently need the ALL to compile the dev project or else you get errors.

How is the dev project 1.14 Kb, yet when I create a new project, it's only a few bytes? When I open the project, why can't I read the cpp code? why do I have to open the cpp separetly?

##### Share on other sites
Drew_Benton    1861
Quote:
 Original post by DarkwareOk, well when I downloaded it, it didn't come with half the files your download file has. o.O so I dunno what the deal was...Question: how can the cpp file be the same name as the dev project file? I try to create a new project, then save the cpp file as the same name as the dev project, but it won't let me. How is this done?Where do you get the MakeFile.win Lesson1.o Lesson1.layout and Lesson1.~cp files? Some of them are encrypted. I tested, and you apparently need the ALL to compile the dev project or else you get errors.How is the dev project 1.14 Kb, yet when I create a new project, it's only a few bytes? When I open the project, why can't I read the cpp code? why do I have to open the cpp separetly?

I would not strongly suggest you ditch your Dev-CPP and get the beta [grin]. Ok, this is what the deal is:

When you download the zip file, it has only has 5 files (the path is different from yours because I downloaded it a few times to make sure it was indeed valid, and it is)

Now when I open up the "lesson1.dev" file, I must comment out that GLaux line. After that I can compile and run.

When I complie, it generates temp files, namely "Lesson1.~cp" and "Lesson1.o". It is just the way Dev-CPP works. They represent the object code files and the ~.cp is a temp file.

Now I mainly suggest that you update your Dev-CPP because you are allowed to have a project named lesson1.dev then have the source file lesson1.cpp, since they are different file names (b/c of extension)

The reason my .dev file is bigger than yours [lol] is because mine has more text in it. I have the linkable libraries already listed and such so I can just ctrl+F10 and it compiles then runs.

The MakeFile.win and Lesson1.layout came with the zip file. Are you sure you are using the link you posted?

If so, upgrade the Dev, and see if your problems are solved. If you have any more questions feel free to ask.

- Drew

## Create an account

Register a new account

• ### Similar Content

• I assumed that if a shader is computationally expensive then the execution is just slower. But running the following GLSL FS instead just crashes
void main() { float x = 0; float y = 0; int sum = 0; for (float x = 0; x < 10; x += 0.00005) { for (float y = 0; y < 10; y += 0.00005) { sum++; } } fragColor = vec4(1, 1, 1 , 1.0); } with unhandled exception in nvoglv32.dll. Are there any hard limits on the number of steps/time that a shader can take before it is shut down? I was thinking about implementing some time intensive computation in shaders where it would take on the order of seconds to compute a frame, is that possible? Thanks.

• There are studios selling applications which is just copying any 3Dgraphic content and regenerating into another new window. especially for CAVE Virtual reality experience. so that the user opens REvite or CAD or any other 3D applications and opens a model. then when the user selects the rendered window the VR application copies the 3D model information from the OpenGL window.
I got the clue that the VR application replaces the windows opengl32.dll file. how this is possible ... how can we copy the 3d content from the current OpenGL window.

Thanks
• By cebugdev
hi all,

i am trying to build an OpenGL 2D GUI system, (yeah yeah, i know i should not be re inventing the wheel, but this is for educational and some other purpose only),
i have built GUI system before using 2D systems such as that of HTML/JS canvas, but in 2D system, i can directly match a mouse coordinates to the actual graphic coordinates with additional computation for screen size/ratio/scale ofcourse.
now i want to port it to OpenGL, i know that to render a 2D object in OpenGL we specify coordiantes in Clip space or use the orthographic projection, now heres what i need help about.
1. what is the right way of rendering the GUI? is it thru drawing in clip space or switching to ortho projection?
2. from screen coordinates (top left is 0,0 nd bottom right is width height), how can i map the mouse coordinates to OpenGL 2D so that mouse events such as button click works? In consideration ofcourse to the current screen/size dimension.
3. when let say if the screen size/dimension is different, how to handle this? in my previous javascript 2D engine using canvas, i just have my working coordinates and then just perform the bitblk or copying my working canvas to screen canvas and scale the mouse coordinates from there, in OpenGL how to work on a multiple screen sizes (more like an OpenGL ES question).
lastly, if you guys know any books, resources, links or tutorials that handle or discuss this, i found one with marekknows opengl game engine website but its not free,
Just let me know. Did not have any luck finding resource in google for writing our own OpenGL GUI framework.
IF there are no any available online, just let me know, what things do i need to look into for OpenGL and i will study them one by one to make it work.
thank you, and looking forward to positive replies.

• I have a few beginner questions about tesselation that I really have no clue.
The opengl wiki doesn't seem to talk anything about the details.

What is the relationship between TCS layout out and TES layout in?
How does the tesselator know how control points are organized?
e.g. If TES input requests triangles, but TCS can output N vertices.
What happens in this case?
http://www.informit.com/articles/article.aspx?p=2120983
the isoline example TCS out=4, but TES in=isoline.
And gl_TessCoord is only a single one.
So which ones are the control points?
How are tesselator building primitives?
• By Orella
I've been developing a 2D Engine using SFML + ImGui.
Here you can see an image
The editor is rendered using ImGui and the scene window is a sf::RenderTexture where I draw the GameObjects and then is converted to ImGui::Image to render it in the editor.
Now I need to create a 3D Engine during this year in my Bachelor Degree but using SDL2 + ImGui and I want to recreate what I did with the 2D Engine.
I've managed to render the editor like I did in the 2D Engine using this example that comes with ImGui.
3D Editor preview
But I don't know how to create an equivalent of sf::RenderTexture in SDL2, so I can draw the 3D scene there and convert it to ImGui::Image to show it in the editor.
If you can provide code will be better. And if you want me to provide any specific code tell me.
Thanks!

• 9
• 9
• 14
• 24
• 37