0

I'm following a book called "Introduction to 3D Game Programming with DirectX 9.0c: A Shader Approach" and all the example there are using Multi-Byte Character Set and I don't want to use it and I don't want my project to be in multi-bye chacters. My problem is there is a debug function on the book here is the code.

//debug
#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 

then on my .cpp files i used this code on the book to create device.

HR(md3dObject->CreateDevice(
        D3DADAPTER_DEFAULT, // primary adapter
        mDevType,           // device type
        mhMainWnd,          // window associated with device
        devBehaviorFlags,   // vertex processing
        &md3dPP,            // present parameters
        &gd3dDevice));      // return created device

then the error is. error C2664: 'DXTraceW' : cannot convert parameter 4 from 'const char [107]' to 'const WCHAR *'

hope someone can help me. thx.

Rf Vote
  • 1
  • 1
  • 2
  • This book is teaching you more than one bad practice. A CreateDevice() failure must end the program. Get rid of the book. – Hans Passant May 12 '13 at 02:31

1 Answers1

1

Try changing the parameter from #x to L#x, or use Microsoft's macro _T(#x).

Mark Ransom
  • 299,747
  • 42
  • 398
  • 622