Skip to main content
gamedev.net
🔒 Locked

PIXELFORMATDESCRIPTOR Problem

Started by minyman22 3 replies 950+ views
Original Post
minyman22
minyman22
I'm currently learning OpenGL from an Ebook, but came across a problem when trying to compile some code. It highlights my PIXELFORMATDESCRIPTOR pfd and claims that "ISO C++ forbids declaration of pfd with no type". At first I thought it was a typo but after copying the source right out of the book and trying it with the downloaded source nothing works. Oh Yeah, I'm using Dev-C++, it's in a class declaration, and it's the only thing wrong in the compiler. Thanks in advance!
bubu LV
bubu LV
This error means that compiler doesn't know what is PIXELFORMATDESCRIPTOR.
You must define it yourself, or just do #include at top of your program. windows.h header will provide this PIXELFORMATDESCRIPTOR structure.
minyman22
minyman22
No dice on including windows.h. It's already in there but still gets the same errors. I could define it myself, but the source from the book doesn't so I shouldn't have to.

The book was published in 2005. Could that affect it?
songho
songho
minyman22,
Try the following Dev-C++ project file;
glinfo.zip

It contains a Dev-C++ project file and source code that uses PIXELFORMATDESCRIPTOR. It may help what is wrong. If it cannot be compiled, then, the Dev-C++ is broken. If it works, then your project setting is not correct.
==song==
minyman22
minyman22
Yours works perfectly songho, let me play around with the project settings and make sure everythings correct.

I went and re-linked all the OpenGL libs but still coudn't get anything. I don't suppose anybody has a screenshot of the proper linking for an OpenGL app. I want to make sure I have it right.

EDIT: Found the problem. I had accidentally defined the PIXELFORMATDESCRIPTOR in my class declaration, thus creating an error. Though the error wasn't very descriptive. Thanks to all who helped.

[Edited by - minyman22 on July 3, 2007 10:10:58 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.