PDA

View Full Version : Windows Programming with Visual C++



12-29-2001, 02:36 AM
I got the OpenGL Game Programming book from LaMothe (Game Development Series). In it, there is a simple hello world program where the window is being programmed. (Until now, I've been using GLUT's windowing methods, and I wanna learn to program the windows myself). The problem isn't in the code. The code compiles. The problem is in the linking phase. I am using "WinMain" as the entry point like the book discusses (copied the code letter for letter) and my visual c++ is all like "where is main"? by saying "Undeclared identifier _main". Now, when I put an empty main in there, the program runs, but doesnt do anything as there is nothing in my main. So basically, my compiler doesn't know to use WinMain as the entry point when I include<windows.h>. Any ideas on what I'm missing?

Ace Corbain

Tron
12-29-2001, 03:44 AM
not really an OpenGL question...

you selected the wrong type of project, try 'win32 application' or something like that(not console)

Leyder Dylan
12-29-2001, 09:58 AM
The more simple.

"Alt-F7"
"Link"

I'm not sure for the beginning but I think that's look like :

change the line "/subsystem:windows" by
"/subsystem:console"

12-29-2001, 09:59 AM
Well, I chose this forum cuz the people on it are smart and really help other people out. Besides, it is a graphics programming question, and I'm using OpenGL library, lets not nitpick over details (C:

Where do I change that setting? I usually just start from scratch using a "C++ Source File", and it has worked for me this far. Do I need to create another type of file instead?

12-29-2001, 10:03 AM
Oh, wait. Layder. You helped me. It works! So, its one of those things you gotta do every time eh? That sucks, just like adding directX libraries. <SIGH> Oh Well. Is there a way to put all that stuff in, and save the settings somewhere so I can just use those settings instead of putting all that in? Or am I doomed to mess with the link tab every single time? Thanks for your help guys! This forum RULES! Full of smart people!

Ace Corbain

12-29-2001, 06:18 PM
Were do I go to learn how to program in OpenGL? I'v been looking around on the web and most of the resources talk about whaat OpenGL can do. I want to know how to program in it. I'm using Dev-C++ 4 compiler with has templates for OpenGL. So can some one point me in the direction to a huge recource on newbie OpenGL programing, or do I have to buy a book? Whitch book should I buy if I had to? I'm wanting to make 2D game first then I'll do a 3D game.

Qazwaz
12-29-2001, 09:44 PM
(To Super Hero)

Have you seen the links to tutorials on this site ( Click here (http://www.opengl.org/developers/code/tutorials.html) )? Also, gametutorials.com (http://www.gametutorials.com/) is great - it has over 30 OpenGl tutorials with fully commented source code. I've got those going with Dev-C++ 4 fairly easily, but if you need help there is a selection of forums including one especially for Dev-C++ users! If you want even more click here (http://www.google.co.uk/search?q=opengl+games+tutorials&hl=en&meta=) .

As it happens, I've just started OpenGl using Dev-C++. If you want we could kind of help each other learn. Just email me on qazwaz@subdimension.com if you want.

[This message has been edited by Qazwaz (edited 12-29-2001).]

endo
12-30-2001, 03:59 AM
Try nehe.gamedev.net (http://nehe.gamedev.net) for arguably the best tutorials around http://www.opengl.org/discussion_boards/ubb/smile.gif

As for Ace's original question it sounds to me like you created a console application when you need a Win32 application, or the other way around.
Console app = main(..)
Win32 app = winMain(...)

12-31-2001, 04:27 PM
Right on!! Mabye I should of looked a little harder. Thaat happens all the time. Me looking over stuff. I'm not a real great programmer either. I bought Sams Teach Yourself C++ in 24 hours and Sams Teach Yourself C in 21 days the Compiler editoin. Witch comes with DJGPP and VC++ introductoin versoin. I'm kinda cheating and going straight to the Games stuff and 3D. I know how to program but just not that good. The Windows programing is just know starting to sink in. But I realy, realy like OpenGL and always had a thang for it. So I'll go and read as much as I can. I'll probebly need help with some thangs. Like detecting key presses. I tried it but I get errors about a few thangs so I'll have to work that out. I'v been on GameDev before and thats were I downloaded the PDF of the Red Book. Well time to get to work. Oh and Happy New Year!

01-01-2002, 07:07 PM
Ok, I'm trying to learnd Glut. But should I? Sence its for a console app witch is basicly dos. Then why should I worry about useing glut if I want to program OpenGL in WIN32. Glut is slower then useing straight out OpenGL too right!? So why bother learning how to rend in Glut when OpenGL is more faster? Should I stick to my windows and not bother with Glut or should I get a grasp on the fundementals in case I wanted to program in for a different OS. Say,..Linux / Unix or Mac. I would like to hear some feedback from some profetional or just experienced programmer on witch one Glu or plain OpenGL would they rather stick to and why!?

Questions Burner
01-01-2002, 07:26 PM
What are you talking about? GLUT just help you create window and handle something like basic input(keyboard and mouse). GLUT is kinda doing all those window programming for you and you do the rendering by yourself, if you're beginner then stick with GLUT first.
Good luck :)