Inicjalizacja directx3d 11 frank luna.
Witam, mam problem z linkerem, nie mam juz pomyslu jak to naprawic :
#include "stdafx.h"
#include "D3DProject.h"
#include "d3dApp.h"
#define MAX_LOADSTRING 100
HINSTANCE hInst;
TCHAR szTitle[ MAX_LOADSTRING ];
TCHAR szWindowClass[ MAX_LOADSTRING ];
class InitDirect3DApp
: public D3DApp
{
public:
InitDirect3DApp( HINSTANCE hInstance );
~InitDirect3DApp();
bool Init();
void OnResize();
void UpdateScene( float dt );
void DrawScene();
};
ATOM MyRegisterClass( HINSTANCE hInstance );
BOOL InitInstance( HINSTANCE, int );
LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );
INT_PTR CALLBACK About( HWND, UINT, WPARAM, LPARAM );
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE prevInstance,
PSTR cmdLine, int showCmd )
{
MSG msg;
HACCEL hAccelTable;
LoadString( hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING );
LoadString( hInstance, IDC_D3DPROJECT, szWindowClass, MAX_LOADSTRING );
MyRegisterClass( hInstance );
if( !InitInstance( hInstance, showCmd ) )
{
return FALSE;
}
hAccelTable = LoadAccelerators( hInstance, MAKEINTRESOURCE( IDC_D3DPROJECT ) );
#if defined(DEBUG) | defined(_DEBUG)
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
InitDirect3DApp theApp( hInstance );
if( !theApp.Init() )
return 0;
return theApp.Run();
while( GetMessage( & msg, NULL, 0, 0 ) )
{
if( !TranslateAccelerator( msg.hwnd, hAccelTable, & msg ) )
{
TranslateMessage( & msg );
DispatchMessage( & msg );
}
}
return( int ) msg.wParam;
}
ATOM MyRegisterClass( HINSTANCE hInstance )
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof( WNDCLASSEX );
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon( hInstance, MAKEINTRESOURCE( IDI_D3DPROJECT ) );
wcex.hCursor = LoadCursor( NULL, IDC_ARROW );
wcex.hbrBackground =( HBRUSH )( COLOR_WINDOW + 1 );
wcex.lpszMenuName = MAKEINTRESOURCE( IDC_D3DPROJECT );
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon( wcex.hInstance, MAKEINTRESOURCE( IDI_SMALL ) );
return RegisterClassEx( & wcex );
}
BOOL InitInstance( HINSTANCE hInstance, int nCmdShow )
{
HWND hWnd;
hInst = hInstance;
hWnd = CreateWindow( szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL );
if( !hWnd )
{
return FALSE;
}
ShowWindow( hWnd, nCmdShow );
UpdateWindow( hWnd );
return TRUE;
}
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch( message )
{
case WM_COMMAND:
wmId = LOWORD( wParam );
wmEvent = HIWORD( wParam );
switch( wmId )
{
case IDM_ABOUT:
DialogBox( hInst, MAKEINTRESOURCE( IDD_ABOUTBOX ), hWnd, About );
break;
case IDM_EXIT:
DestroyWindow( hWnd );
break;
default:
return DefWindowProc( hWnd, message, wParam, lParam );
}
break;
case WM_PAINT:
hdc = BeginPaint( hWnd, & ps );
EndPaint( hWnd, & ps );
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
default:
return DefWindowProc( hWnd, message, wParam, lParam );
}
return 0;
}
INT_PTR CALLBACK About( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
UNREFERENCED_PARAMETER( lParam );
switch( message )
{
case WM_INITDIALOG:
return( INT_PTR ) TRUE;
case WM_COMMAND:
if( LOWORD( wParam ) == IDOK || LOWORD( wParam ) == IDCANCEL )
{
EndDialog( hDlg, LOWORD( wParam ) );
return( INT_PTR ) TRUE;
}
break;
}
return( INT_PTR ) FALSE;
}
InitDirect3DApp::InitDirect3DApp( HINSTANCE hInstance )
: D3DApp( hInstance )
{
}
InitDirect3DApp::~InitDirect3DApp()
{
}
bool InitDirect3DApp::Init()
{
if( !D3DApp::Init() )
return false;
return true;
}
void InitDirect3DApp::OnResize()
{
D3DApp::OnResize();
}
void InitDirect3DApp::UpdateScene( float dt )
{
}
void InitDirect3DApp::DrawScene()
{
assert( md3dImmediateContext );
assert( mSwapChain );
md3dImmediateContext->ClearRenderTargetView( mRenderTargetView, reinterpret_cast < const float *>( & Colors::Blue ) );
md3dImmediateContext->ClearDepthStencilView( mDepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0 );
HR( mSwapChain->Present( 0, 0 ) );
}
konsola bledow:
Error 1 error LNK2019: unresolved external symbol _DXTraceW@20 referenced in function "public: virtual void __thiscall InitDirect3DApp::DrawScene(void)" (?DrawScene@InitDirect3DApp@@UAEXXZ) C:\Users\Maciej\documents\visual studio 2013\Projects\D3DProject\D3DProject\D3DProject.obj D3DProject
Error 6 error LNK2019: unresolved external symbol "public: virtual void __thiscall D3DApp::OnResize(void)" (?OnResize@D3DApp@@UAEXXZ) referenced in function "public: virtual void __thiscall InitDirect3DApp::OnResize(void)" (?OnResize@InitDirect3DApp@@UAEXXZ) C:\Users\Maciej\documents\visual studio 2013\Projects\D3DProject\D3DProject\D3DProject.obj D3DProject
Error 5 error LNK2019: unresolved external symbol "public: virtual bool __thiscall D3DApp::Init(void)" (?Init@D3DApp@@UAE_NXZ) referenced in function "public: virtual bool __thiscall InitDirect3DApp::Init(void)" (?Init@InitDirect3DApp@@UAE_NXZ) C:\Users\Maciej\documents\visual studio 2013\Projects\D3DProject\D3DProject\D3DProject.obj D3DProject
Error 3 error LNK2019: unresolved external symbol "public: virtual __thiscall D3DApp::~D3DApp(void)" (??1D3DApp@@UAE@XZ) referenced in function "public: virtual __thiscall InitDirect3DApp::~InitDirect3DApp(void)" (??1InitDirect3DApp@@UAE@XZ) C:\Users\Maciej\documents\visual studio 2013\Projects\D3DProject\D3DProject\D3DProject.obj D3DProject
Error 4 error LNK2019: unresolved external symbol "public: int __thiscall D3DApp::Run(void)" (?Run@D3DApp@@QAEHXZ) referenced in function _WinMain@16 C:\Users\Maciej\documents\visual studio 2013\Projects\D3DProject\D3DProject\D3DProject.obj D3DProject
Error 2 error LNK2019: unresolved external symbol "public: __thiscall D3DApp::D3DApp(struct HINSTANCE__ *)" (??0D3DApp@@QAE@PAUHINSTANCE__@@@Z) referenced in function "public: __thiscall InitDirect3DApp::InitDirect3DApp(struct HINSTANCE__ *)" (??0InitDirect3DApp@@QAE@PAUHINSTANCE__@@@Z) C:\Users\Maciej\documents\visual studio 2013\Projects\D3DProject\D3DProject\D3DProject.obj D3DProject
Error 7 error LNK2001: unresolved external symbol "public: virtual long __thiscall D3DApp::MsgProc(struct HWND__ *,unsigned int,unsigned int,long)" (?MsgProc@D3DApp@@UAEJPAUHWND__@@IIJ@Z) C:\Users\Maciej\documents\visual studio 2013\Projects\D3DProject\D3DProject\D3DProject.obj D3DProject
Error 8 error LNK1120: 7 unresolved externals C:\Users\Maciej\documents\visual studio 2013\Projects\D3DProject\Debug\D3DProject.exe D3DProject