Sign in to follow this  
Kirjuxa

Problems with DxErr.lib

Recommended Posts

Kirjuxa    100
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

Share this post


Link to post
Share on other sites
Promethium    580
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

Share this post


Link to post
Share on other sites
Promethium    580
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.

Share this post


Link to post
Share on other sites
Kirjuxa    100
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this