Feb 12, 2013 at 11:03pm UTC
So I've started to try some DirectX 11 with the help of a Begginer's book, although at my first debug I'm having errors :S
I've even copied the code word for word from the book just to make sure I'm not making any silly syntax erros, although I am still getting the error:
"Unable to start program 'C:.....\DXBlankWindow.exe'. The system cannot find the file specified."
---Error List---
Error 1 error LNK2019: unresolved external symbol "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) referenced in function _wWinMain@16 C:\Users\Tim\Documents\Visual Studio 2010\Projects\DirectXTuts\DXBlankWindow\DXBlankWindow\main.obj
Error 2 error LNK1120: 1 unresolved externals C:\Users\Tim\Documents\Visual Studio 2010\Projects\DirectXTuts\DXBlankWindow\Debug\DXBlankWindow.exe 1
And after checking the projects debug folder there isn't a .exe file created.
I've also run a simple program to check if the project will run and it does this fine and creates the .exe file, and I've changed the runtime library to 'Multi Threaded Debug (/MTd).
I'm probably doing something very basic and very simple wrong, but I can't for the life of me work out what. Any help would be really really appreciated. I guess theres nothing more to say other than here's the code:
#include<Windows.h>
LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE prevInstance, LPWSTR cmdLine, int cmdShow )
{
UNREFERENCED_PARAMETER( prevInstance );
UNREFERENCED_PARAMETER( cmdLine );
WNDCLASSEX wndClass = { 0 };
wndClass.cbSize = sizeof( WNDCLASSEX ) ;
wndClass.style = CS_HREDRAW | CS_VREDRAW;
wndClass.lpfnWndProc = WndProc;
wndClass.hInstance = hInstance;
wndClass.hCursor = LoadCursor( NULL, IDC_ARROW );
wndClass.hbrBackground = ( HBRUSH )( COLOR_WINDOW + 1 );
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = "DX11BookWindowClass";
if( !RegisterClassEx( &wndClass ) )
return -1;
RECT rc = { 0, 0, 640, 480 };
AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE );
HWND hwnd = CreateWindowA( "DX11BookWindowClass", "Blank Win32 Window",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc. left,
rc.bottom - rc.top, NULL, NULL, hInstance, NULL );
if( !hwnd )
return -1;
ShowWindow( hwnd, cmdShow );
// Demo Initialize
MSG msg = { 0 };
while( msg.message != WM_QUIT )
{
if( PeekMessage( &msg, 0, 0, 0, PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
// Update
// Draw
}
// Demo Shutdown
return static_cast<int>( msg.wParam );
}