window creation using windows api
im a beginner games programmer still, but i think im at the point where im a bit tired of writing stuff for console and want to get either directx or opengl initialised. and apparently i need to make a blank window using the windows api, for the best result.
ive tried tons of tutorials on this, such as http://www.cprogramming.com/tutorial/opengl_first_windows_app.html
if i use the code from this tutorial i get errors, such as:
error C2371: 'WNDCLASS' : redefinition; different basic types
error C2143: syntax error : missing ';' before '.'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2371: 'window_class' : redefinition; different basic types
'LPCTSTR' : illegal use of this type as an expression
and so on, repeated many times
and the same errors from pretty much any other tutorial. i tried a project that came with my "teach yourself game programming with directx in 21 days" book, and visual studio did some kind of conversion and then it worked, so i think there might be a problem with my version of visual studio?
so far it seems like nothing ive programmed yet. i understand the structure (to some extent) such as the way the functions are defined, the main loop, the process of setup, creation, registration, event handler, but it all just seems like a lot to remember, is it really necessary to remember all this? or can i get it working once and then not write it ever again? or does anyone know an easier approach to this ?
cheers
Just glancing over that tut and your errors you might have missed that it is WNDCLASSEX and not just WNDCLASS. This is located in two spots, once to define the window class object and once to define the size of the object (they're about 5 lines apart). If you post the code from that tutorial that you wrote which doesn't compile we could help you more.
i commented out #include "stdafx.h" and the list of errors changed. i pasted the code and the errors in this pastebin
http://gamedev.pastebin.com/m265c04d7
http://gamedev.pastebin.com/m265c04d7
*Never* learn with tutorials (written by kids...)
Read the Petzold + the Richter, and you'll be able to do everything.
Read the Petzold + the Richter, and you'll be able to do everything.
Quote:Original post by guitarguy
i commented out #include "stdafx.h" and the list of errors changed. i pasted the code and the errors in this pastebin
http://gamedev.pastebin.com/m265c04d7
Why do you mix Unicode and non-Unicode ?!
Quote:Original post by george135
*Never* learn with tutorials (written by kids...)
Read the Petzold + the Richter, and you'll be able to do everything.
Thanks for the recommendation, guy
it might be a few days before i can get hold of a book, unless there is some online version of it. i didnt write the tutorial, but if anybody has any idea how to get this to compile on my version of visual basic it would be much appreciated.im using visual studio 2005 v8.0.
cheers
I didn't want to say this before because I was hoping that changing WNDCLASSEX would fix it, but I would seriously consider a different tutorial. I've built a couple simple graphical demos with DirectX and haven't seen many of the lines you've got there. Not to say they're not useful and don't work, but it seems quite unconventional, at least to me.
Try the window tutorial at C-Unit and see if that works. If not theres probably something wrong with your includes but from the errors you mentioned I think it's more of a fact that the tutorial might be outdated.
Only if the tutorials suck, which they usually do.
Talk to programmers and learn when to distinguish a good tutorial from a bad one (based on certain lines). Do NOT copy and paste and hit build/run, you will not learn anything and it probably will not work (not that you are, just as a general guideline). When I get home I'll see if I can compile a simple window program for ya if I remember.
Try the window tutorial at C-Unit and see if that works. If not theres probably something wrong with your includes but from the errors you mentioned I think it's more of a fact that the tutorial might be outdated.
Quote:*Never* learn with tutorials (written by kids...)
Only if the tutorials suck, which they usually do.
Talk to programmers and learn when to distinguish a good tutorial from a bad one (based on certain lines). Do NOT copy and paste and hit build/run, you will not learn anything and it probably will not work (not that you are, just as a general guideline). When I get home I'll see if I can compile a simple window program for ya if I remember.
Quote:but if anybody has any idea how to get this to compile on my version of visual basic it would be much appreciated
I will be very impressed indeed if someone can do that, seeing as this is C.
Quote:Original post by PortmanteauQuote:but if anybody has any idea how to get this to compile on my version of visual basic it would be much appreciated
I will be very impressed indeed if someone can do that, seeing as this is C.
Game...set...match. Wow, I can't believe I didn't notice that earlier. Man, I just got slapped with a noob stick. Granted I knew it wasn't VB at least.
I'm thinking he did not mean Visual Basic because the errors he posted are C++ compiler errors. I just realized you are on Visual Studio 2005, you need the Platform SDK.
EDIT: I recommend these tutorials.
EDIT: I recommend these tutorials.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement