I am somewhat new to using DirectX
I encountered a few linker errors on the test project that I am doing. I cannot tell if these are windows (MSPSDK) linker errors, or DirectX library errors.
Anyway, I looked up the error codes, but found myself overwhelmed. I am not using MFC or any of the Standard C options that it tells me I should turn off (at least, I don't think I am). Anyway, if I could get somehelp debugging this that would be awesome :)
EDIT: Ahhh! forgot to post code and errors:
1>------ Rebuild All started: Project: Austens Direct X, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'Austens Direct X', configuration 'Debug|Win32'
1>Compiling...
1>stdafx.cpp
1>Compiling...
1>Austens Direct X.cpp
1>Compiling resources...
1>Compiling manifest to resources...
1>Linking...
1>Austens Direct X.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function _WinMain@16
1>C:\Documents and Settings\Admin\My Documents\C++ Projects\Direct X\Austens Direct X\Debug\Austens Direct X.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Admin\My Documents\C++ Projects\Direct X\Austens Direct X\Austens Direct X\Debug\BuildLog.htm"
1>Austens Direct X - 2 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
and the Main File:
// Austens Direct X.cpp : Defines the entry point for the application.
//
#include <windows.h>
#include <windowsx.h>
#include "stdafx.h"
#include <d3d9.h>
#include <d3dx9.h>
#include "Austens Direct X.h"
#define WIN32_LEAN_AND_MEAN
bool bactive = true;
bool Init();
bool Frame();
bool Shutdown();
void Error(int code);
LRESULT CALLBACK MsgHandler(
HWND hwnd, // window handle
UINT msg, // the message identifier
WPARAM wparam, // message parameters
LPARAM lparam // more message parameters
);
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX WindowsClass; // declare structure variable
WindowsClass.cbSize = sizeof(WNDCLASSEX); // always use this!
WindowsClass.style = CS_DBLCLKS | CS_OWNDC |
CS_HREDRAW | CS_VREDRAW; // standard settings
WindowsClass.lpfnWndProc = MsgHandler; // we need to write this!
WindowsClass.cbClsExtra = 0; // extra class info, not used
WindowsClass.cbWndExtra = 0; // extra window info, not used
WindowsClass.hInstance = hinstance; // parameter passed to WinMain()
WindowsClass.hIcon = LoadIcon(NULL, IDI_WINLOGO); // Windows logo
WindowsClass.hCursor = LoadCursor(NULL, IDC_ARROW); // standard cursor
WindowsClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); // a simple black brush
WindowsClass.lpszMenuName = NULL; // no menu
WindowsClass.lpszClassName = TEXT("Windows Class"); // class name
WindowsClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO); // Windows logo again
RegisterClassEx(&WindowsClass);
MSG msg;
HWND hwnd;
if (!(hwnd = CreateWindowEx(NULL, // extended style, not needed
TEXT("Windows Class"), // class identifier
TEXT("Windows Class"), // window title
WS_POPUP | WS_VISIBLE, // parameters
0, 0, 800, 600, // initial position, size
NULL, // handle to parent (the desktop)
NULL, // handle to menu (none)
hinstance, // application instance handle
NULL))) // who needs it?
return(0);
//Initilize DirectX here
IDirect3D9 *iD3D;
if((iD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL)
{
}
while(bactive)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return(0);
}
LRESULT CALLBACK MsgHandler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
switch(msg)
{
case WM_CREATE:
//Initialize windows here
return(0);
case WM_DESTROY:
PostQuitMessage(0);
return(0);
case WM_CLOSE:
DestroyWindow(hwnd);
return(0);
case WM_KEYDOWN:
switch(wparam)
{
case VK_ESCAPE:
//SendMessage (hwnd, WM_DESTROY, NULL, 0) ;
PostQuitMessage(0);
bactive = false;
break;
}
return(0);
}
return(DefWindowProc(hwnd, msg, wparam, lparam));
}
bool Init()
{
return true;
}
bool Frame()
{
return true;
}
bool Shutdown()
{
return true;
}
void Error(int code)
{
MessageBox(NULL, TEXT("An Error has interupted the program \n Please check you error code against \n those commonly encountered in you manual \n Code:" + code),TEXT("Program has Halted"), MB_ICONERROR);
}
[Edited by - Plasmarobo on April 29, 2006 8:44:45 PM]
___________________________________________________Optimists see the glass as Half FullPessimists See the glass as Half EmptyEngineers See the glass as Twice as big as it needs to be