Problems with DxErr.lib

Started by
4 comments, last by Kirjuxa 13 years, 11 months ago
Hi, I am learning DirectX programming and in the beginning of my book I have some Problems. i have this Code: #if defined(DEBUG) | defined(_DEBUG) #ifndef D3D_DEBUG_INFO #define D3D_DEBUG_INFO #endif #endif #if defined(DEBUG) | defined(_DEBUG) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif #include "stdafx.h" #include <iostream> #include <d3d9.h> #include <DxErr.h> #if defined (DEBUG) #pragma comment (lib,"d3dx9d.lib") #pragma comment (lib,"dxerr.lib") #endif #pragma comment (lib,"d3d9.lib") HRESULT DXTrace(CHAR *strFile, DWORD dwline, HRESULT hr, CHAR *strMsg, BOOL bPopMsgBox); #if defined(DEBUG) | defined(_DEBUG) #ifndef HR #define HR(x) { HRESULT hr = x; if(FAILED(hr)) { DXTrace(__FILE__, __LINE__, hr, #x, TRUE); } } #endif #else #ifndef HR #define HR(x) x; #endif #endif using namespace std; int _tmain(int argc, _TCHAR* argv[]) { IDirect3D9* myObj = Direct3DCreate9(D3D9b_SDK_VERSION); D3DDISPLAYMODE mode; myObj->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&mode); HR(myObj->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, mode.Format, mode.Format, true)); fflush(stdin); getchar(); return 0; } the code ist from my book. I am using DirectX SDK_August09 and Visual Studio 2008. If I start as Release then, everything is ok. It compiles and runs(actually just a single black sheel window). But if I start in Debug then the linker has problems linking the DxTrace function from DxErr.h Linker Error: Fehler 1 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""long __cdecl DXTraceW(char *,unsigned long,long,char *,int)" (?DXTraceW@@YAJPADKJ0H@Z)" in Funktion "_wmain". DirectX_Test.obj DirectX_Test I am sure that i included the Headerfiles and the Lib files and libraries in my IDE correctly. Can anybody help me?? Where is the f***ng problem?? Why he cannot link the DxErr.lib I also did not find the DxErr.dll(is that the problem?? But it was not in the SDK within, neither in Aug09 nor in the newest one) Thanks
Advertisement
The standard 'debugging enabled' symbol in Visual Studio is _DEBUG. Try changing DEBUG in
#if defined (DEBUG)#pragma comment (lib,"d3dx9d.lib")#pragma comment (lib,"dxerr.lib")#endif
to _DEBUG.

EDIT: You should also add a #else in there, otherwise you will get at least warnings or errors from the linker:
#if defined (_DEBUG)#pragma comment (lib,"d3dx9d.lib")#pragma comment (lib,"dxerr.lib")#else#pragma comment (lib,"d3d9.lib")#endif
Well i tried,
it still does not work :(
Thanks, but it does not work.

Where can i find the DxErr.dll??

It is not in the SDK
1) Remove the line
HRESULT DXTrace(CHAR *strFile, DWORD dwline, HRESULT hr, CHAR *strMsg, BOOL bPopMsgBox);

Short story: It is defined in DxErr.h and you should *not* repeat it in your code.

Long story: DXTrace is actually a macro that selects between two versions, DXTraceW and DXTraceA, based on whether or not you are compiling with Unicode support. This is a common trick in Microsoft SDK's.

2) There is no DxErr.dll, it's part of d3d9.dll. But you can ignore that, as the system automagically loads the correct D3D dll's.
DAMN, it works!!!!

Thanks a lot!! 2 Days I have spent at school now for solving the problem.

I thought my system is damaged or so.

Well the only thing I had now was the wrong conversion from con char[99] to WCHAR*

but I changed the header file a bit and it worked now.

YOUR THE MAN :)

BIG THANK YOU DUDE

This topic is closed to new replies.

Advertisement