Ok I buy this bbok called "OpenGL Game Programming", never programmed in windows maybe jumped the gun a little but I dont think thats why this is happening. They show you how to make a Hello World program in windows. I did it and it worked. Next they show a little more advanced version of Hello World in windows, but this one gives me a strange error here is the code:
#define WIN32_MEAN_AND_LEAN
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT paintStruct;
HDC hDC;
char string[] = "Hello, World!";
switch(message)
{
case WM_CREATE:
return 0;
break;
case WM_CLOSE:
PostQuitMessage(0);
return 0;
break;
case WM_PAINT:
hDC = BeginPaint(hwnd, &paintStruct);
SetTextColor(hDC, COLORREF(0x00FF0000));
TextOut(hDC, 150, 150, string, sizof(string)-1);
EndPaint(hwnd, &paintStruct);
return 0;
break;
default:
break;
}
return (DefWindowProc(hwnd, message, wParam, lParam));
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
WNDCLASSEX windowClass;
HWND hwnd;
MSG msg;
bool done;
windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.style = CS_HREDRAW | CS_VREDRAW;
windowClass.lpfnWndProc = WndProc;
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hInstance = hInstance;
windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
windowClass.lpszMenuName = NULL;
windowClass.lpszClassName = "MyClass";
windowClass.hIconSM = LoadIcon(NULL, IDI_WINLOGO);
if (!RegisterClassEx(&windowClass))
return 0;
hwnd = CreateWindowEx(Null,
"MyClass",
"A real Windows Application!",
WS_OVERLAPPEDWINDOW |
WS_VISIBLE |
WS_SYSMENU,
100, 100,
400, 400,
NULL,
NULL,
hInstance,
NULL);
if (!hwnd)
return 0;
done = false;
while (!done)
{
PeekMessage(&msg, hwnd, NULL, NULL, PM_REMOVE);
if (msg.message == WM_QUIT)
{
done = true;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return msg.wParam;
}
Now when I compile I get this error:
--------------------Configuration: firsttry - Win32 Debug--------------------
Compiling...
firsttry1.cpp
c:\dev-c++\examples\firsttry\firsttry1.cpp(92) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.
firsttry.exe - 1 error(s), 0 warning(s)
Now when I go to help to look up the error it tells me this:
Fatal Error C1010
unexpected end of file while looking for precompiled header directive
A precompiled header was specified, but it did not contain a precompiled header directive.
This error can be caused by specifying an incorrect file as a header file, or by specifying an include file with the /Yu (Use Precompiled Header) command line option that is not listed in the source file as an include file.
Since reading this I think its because I am running Dev-c++ Windows.h but really not sure thats why I writing to you
![](tongue.gif)
.
BTW I am usuing VC++.
Thx,
Jeff Desrosiers
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton