hey im trying to learn graphics/games and well DirectX seems to be the main graphics thing for windows and i copy and pasted this code from the tutorial i was using and got an error and not sure why
am using 2003 visual studio .net compiler and on the Dev Compiler cause i only have the .net one cause school gave it to me but on the Dev compiler i got similar errors as well so
thanks
Code:
// Standard windows include
#include <windows.h>
// Message Loop CallBack Function prototype
LRESULT CALLBACK fnMessageProcessor (HWND, UINT, WPARAM, LPARAM);
// Function called automatically when the program starts
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine,int iCmdShow)
{
HWND hWnd;
MSG msg;
WNDCLASSEX wndclass;
// Set up window class
wndclass.cbSize = sizeof(WNDCLASSEX);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = fnMessageProcessor;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "Window Class";
// Class Name
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
// Register the window class
if(RegisterClassEx(&wndclass) == 0)
{
// The program failed, exit
exit(1);
}
// Create the window
hWnd = CreateWindowEx(
WS_EX_OVERLAPPEDWINDOW,
"Window Class", // Class name
"Create Window Example", // Title bar text
WS_OVERLAPPEDWINDOW,
0,
0,
320,
200,
NULL,
NULL,
hInstance,
NULL);
// Display the window
ShowWindow(hWnd, iCmdShow);
// Process messages until the program is terminated
while(GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}
// Message loop callBack function (REQUIRED FOR ALL WINDOWS PROGRAMS)
LRESULT CALLBACK fnMessageProcessor (HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
switch(iMsg)
{
// Called when window is first created
case WM_CREATE:
return(0);
// Called when the window is refreshed
case WM_PAINT:
return(0);
// Called when the user closes the window
case WM_DESTROY:
PostQuitMessage(0);
return(0);
default:
return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
}
.NET ERRORS
c:\source\game learn\game learn proj\createwindow.cpp(60): warning C4244: 'return' : conversion from 'WPARAM' to 'int', possible loss of data
game learn proj error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
game learn proj fatal error LNK1120: 1 unresolved externals
DEV ERRORS
[Linker error] undefined reference to `GetStockObject@4'
C:\source\Makefile.win [Build Error] [Project1.exe] Error 1