c ++ compilers

Started by
13 comments, last by Sabonis 21 years, 8 months ago
i have the visual c ++ introduction version that i bought for 50 bucks a year or so ago.. Im wondering if its a piece of $hit because im having so much trouble with it. Have you guys had any luck with it, or are you running the professional editions? "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein (1879-1955) That is so very true... [edited by - Sabonis on August 26, 2002 2:50:39 PM]
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein (1879-1955) That is so very true...
Advertisement
If you''re having problems with it, the chances are very very good that they stem from the fact that you''re a beginning programmer, not from limitations of the compiler (which, though not as optimizing as the professional edition, isn''t bad at all.)


Don''t listen to me. I''ve had too much coffee.
What problems are you having?

---
Make it work.
Make it fast.

"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
i never had any trouble with introductory while i had it(it came with a book) I only used it for a month or so before i actually bought standard edition, but i never had any trouble with it (except initialy learning to use it)


-Nicholas Anton
-www.geocities.com/nickanton7/
In my time I''ve used the introductory/standard/pro & enterprise editions of VC6 and now have VC.net and have never had a problem with any of them.
ive been having problems with lockups and freezing with some code i wrote in the past (you can check my threads in the direct x forum). For this particular code, it says that my bDraw is an undeclared identifier, but i got the code straight out of my book. I am really a newb and probably am missing something really obvious, but hey we all gotta start somewhere...


  #define WIN32_LEAN_AND_MEAN// The main windows include file#include <windows.h>#include <stdlib.h>int GameInit();int GameLoop();int GameShutdown();HDC g_hDC;HWND g_hWndMain;// The window procedure to handle eventslong CALLBACK WndProc( HWND hWnd, UINT uMessage,                                 WPARAM wParam, LPARAM lParam ){	PAINTSTRUCT PaintStruct;	// Structure used during windows painting	HDC hDC;	static HBITMAP hBitmap = 0;// Handle to device context for painting	// Switch the windows message to figure out what it is	switch( uMessage )	{		case WM_CREATE:	// The CreateWindow() function was just called		{			//  One Time Initialization						return 0;		}		case WM_PAINT:	// The window needs to be redrawn		{			// Tell windows we want to start updating the window			hDC = BeginPaint( hWnd, &PaintStruct );									//Tell windows we have finished updating the window			EndPaint( hWnd, &PaintStruct );			return 0;		}				case WM_DESTROY:	// The window is about to be closed		{			// Our main window is closing.  This means we want our app to exit.			// Tell windows to put a WM_QUIT message in our message queue									PostQuitMessage( 0 );			return 0;		}		case WM_LBUTTONDOWN:			{				bDraw = TRUE;				return 0;			}		case WM_LBUTTONUP:			{				bDraw = FALSE;				return 0;			}		case WM_MOUSEMOVE:			{				HDC hDC = GetDC(g_hWndMain);				static int xPos = LOWORD(lParam);				static int yPos = HIWORD(lParam);				if(bDraw)				{					MoveToEx(hDC,xPos,yPos,NULL);					LineTo(hDC, LOWORD(lParam), HIWORD(lParam));				}				xPos = LOWORD(lParam);				yPos = HIWORD(lParam);				ReleaseDC(g_hWndMain, hDC);				return 0;			}				case WM_CHAR:			{				switch(wParam)				{				case 'x':					{						PostQuitMessage(0);						break;					}				default:					break;				}				return 0;			}		default:			// Some other message		{			// Let windows handle this message			return DefWindowProc( hWnd, uMessage, wParam, lParam );		}	}}// The windows entry point. The application will start executing hereint WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,                                     PSTR pstrCmdLine, int iCmdShow ){	HWND hWnd;		// The handle to our main window	MSG msg;		// The message windows is sending us	WNDCLASSEX wc;	// The window class used to create our window	// The name of our class and also the title to our window	static char strAppName[] = "First Windows App, CGM style";	//LOGBRUSH CrossHatchBrush;	//CrossHatchBrush.lbStyle = BS_HATCHED;	//CrossHatchBrush.lbColor = RGB(255,0,255);	//CrossHatchBrush.lbHatch = HS_DIAGCROSS;	//HBRUSH hCrossBrush = CreateBrushIndirect(&CrossHatchBrush);		// Fill in the window class with the attributes for our main window	// The size of this struture in bytes	wc.cbSize			= sizeof( WNDCLASSEX );		//  The style of the window.	wc.style			= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;	// Useless information.  Just set to zero.	wc.cbClsExtra		= 0;	// Useless information.  Just set to zero.	wc.cbWndExtra		= 0;	// The name of our event handler	wc.lpfnWndProc		= WndProc;	// A handle to the applications instance	wc.hInstance		= hInstance;	// The handle to the brush to use for the window background	wc.hbrBackground	= (HBRUSH)GetStockObject(DKGRAY_BRUSH);	// A handle to the icon to use for the window	wc.hIcon			= LoadIcon( NULL, IDI_APPLICATION );	// A handle to a smaller version of the apps icon	wc.hIconSm			= LoadIcon( NULL, IDI_APPLICATION );	// A handle to the cursor to use while the mouse is over our window	wc.hCursor			= LoadCursor( NULL, IDC_CROSS );	// A handle to the resource to use as our menu	wc.lpszMenuName		= NULL;	// The human readable name for this class	wc.lpszClassName	= strAppName;	// Register the class with windows	RegisterClassEx( &wc );	// Create the window based  on the previous class	hWnd = CreateWindowEx( NULL,	// Advanced style settings	            strAppName,			// The name of the class				strAppName,			// The window caption				WS_OVERLAPPEDWINDOW,// The window style			   	CW_USEDEFAULT,		// The initial x position                 CW_USEDEFAULT,		// The initial y position			   	900, 900,			// The intiial width / height				NULL,				// Handle to parent window										NULL,				// Handle to the menu				hInstance,			// Handle to the apps instance				NULL );				// Advanced context	g_hWndMain = hWnd;			GameInit();	// Display the window we just created	ShowWindow( hWnd, iCmdShow );	// Draw the window contents for the first time	UpdateWindow( hWnd );		// Start the message loop	while( TRUE )	{		// Check if a message is waiting for processing		if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )		{			// Check if the message is to quit the application			if( msg.message == WM_QUIT )				// Exit the message loop				break;						// Change the format of certain messages			TranslateMessage( &msg );			// Pass the message to WndProc() for processing			DispatchMessage( &msg );		}		else		{			GameLoop();		}		}	GameShutdown();	// Return control to windows with the exit code	return msg.wParam;}		int GameInit()	{		return 0;		}	int GameLoop()	{	return 0;	}		int GameShutdown()	{			return 0;	}  


[Edit: Please always place that much code between source tags. See the FAQ Forum FAQ for details.]

"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."
- Albert Einstein (1879-1955)
That is so very true...

[edited by - Oluseyi on August 26, 2002 4:56:58 PM]
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein (1879-1955) That is so very true...
yup bDraw is undeclared, ie no where in that code do you tell the compiler what bDraw is, you probably want a line that declares it such as :

BOOL bDraw = true;

which should sort it (possibly), though make sure that line is above the first place that you use bDraw....

[edited by - RobTheBloke on August 26, 2002 4:52:43 PM]
Thank you very much, it worked good except that I set it to FALSE so that it wouldnt draw right off the start when the mouse wasnt depressed. How did you know to type that in? It''s a macro isnt it? Then how come you dont have to do that with the RGB macro?
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein (1879-1955) That is so very true...
What? No. He just declared the bDraw variable. Nothing strange there. No, bDraw isn't a macro, it's a variable you have to declare and just neglected to.

If you're confused by the BOOL thing (it's usually written in lowercase), it's just MSVC's weird way of having another boolean type. AFAIK, the uppercase and lowercase versions are entirely interchangeable.

And the RGB macro is declared. You just can't see it. It's in one of the Windows header files you have included at the beginning of the program (beats me which one).

-Auron

[edited by - Auron on August 26, 2002 5:36:46 PM]
quote:Original post by Auron


And the RGB macro is declared. You just can''t see it. It''s in one of the Windows header files you have included at the beginning of the program (beats me which one).


wingdi.h, but include windows.h for it....

This topic is closed to new replies.

Advertisement