Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Fredric

OpenGL *really* basic OpenGL problem

This topic is 6732 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I copied the following piece of code from OpenGL Super Bible, but when I compile it, it brings up two errors! #include #include // Console I/O functions #include // OpenGL functions #include // AUX Library functions void main(void) { // These are the AUX functions to set up the window auxInitDisplayMode(AUX_SINGLE / AUX_RGBA); auxInitPosition(100,100,250,250); auxInitWindow("My first OpenGL Program"); // These are the OpenGL functions that do something in the window glClearColor(0.0f, 0.0f, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glFlush(); // Stop and wait for a keypress cprintf("Press any key to close the Window\n"); getch(); } I thought I could catcht the first error- cprintf? Is that correct? When I bump off the c, the number of errors is reduced to one, but why would the author put a c in front of printf? Anyhow, the other error I can''t find. What''s wrong with this? The following libraries are include: opengl32.lib glaux.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib can anyone please please help me with this? If this book is going to be full of errors, I''m gonna be upset... Programming::~Fredric(const Annoy_Ance)

Share this post


Link to post
Share on other sites
Advertisement
It might help if you posted the second error.

Also, I thought cprintf was a valid function. I might be thinking UNIX though. You might try _cprintf instead.

Share this post


Link to post
Share on other sites
*sigh* because the compiler SAYS SO!!! Aren''t you a programmer?!?

Programming::~Fredric(const Annoy_Ance)

Share this post


Link to post
Share on other sites
Ok, when *my* compiler says there are two errors, it tells me what they are. e.g. Line 2: misplaced semicolon ( or something like that. What errors are your compilers telling you?

btw. You might want to delete some of those duplicate posts.

Share this post


Link to post
Share on other sites
How did you create the project? You are using Visual C++ I assume? You need to be sure that whatever compiler you are using knows you are trying to compile a console app. In Visual C++ this is just a matter of picking console app within the create project wizard.

cprintf and getch only make sense within the context of a console app, and your mysterious second error when cprintf is removed is probably a linking error due to the fact that the linker is looking for a WinMain and not finding one.

Share this post


Link to post
Share on other sites
So, how do I change that, and make everything work? It''s already a console application.

Programming::~Fredric(const Annoy_Ance)

Share this post


Link to post
Share on other sites
I believe that''s just due to this message board''s weird handling of the greater than and less than symbols. It thinks he is trying to do some HTML stuff.

In any case, what process did you go about in creating the project? Or did you import it from the book sample?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
One thing you should be aware of... that book is based on opengl for unix. Another note, its no where near a ''super bible''. That aside look under the gamedev.net programers section and then opengl section. There you will see a articual entilled "Example of the Minimal Win32 & OpenGL program". Note the program does make one mistake, arguments to the call ReleaseDC was switched. Add Opengl32.lib and glu32.lib to your project settings and this program should compile without any problems.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!