Skip to main content
GameDev.net gamedev.net
🔒 Locked

'D3DXLoadMeshFromXW' : cannot convert parameter 1 from 'const char [9]' to 'LPCWSTR'

Started by Emexus Aug 29, 2006 at 1:17 PM 2 replies 4.5k views
Original Post
Emexus
Emexus
from all the example code ive been reading through thay have the .x file name declared like so:

HRESULT hr = D3DXLoadMeshFromX("sphere.x", D3DXMESH_SYSTEMMEM,
				pD3DDevice9, NULL,							&materialBuffer, NULL, &numMaterials, 
	         		&mesh);
but i keep getting a "cannot convert parameter 1 from 'const char [9]' to 'LPCWSTR'" error on my compiler. am i missing something simple here? visual studio 2005.net & DirectX9 cheers Jay
jollyjeffers
jollyjeffers
You're not passing in a Unicode string - put an "L" before the string literal: L"sphere.x" or use the TEXT("sphere.x") or _T("sphere.x") macros...

If you're not familiar with unicode then I suggest you do a bit of reading on MSDN or via your favourite search engine. Unicode > ASCII [smile]

hth
Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |
Emexus
Emexus
thanks for that, i forgot all about unicode although ive always done TEXT() i never new about putting a L before it.

i now recieve a "LNK2019: unresolved external symbol _D3DXLoadMeshFromXW@32 referenced in function "long __cdecl InitDirect3D(struct HWND__ *,int,int,bool)" (?InitDirect3D@@YAJPAUHWND__@@HH_N@Z)" error?
Emexus
Emexus
ok realise now that im not linking to the right library

all sorted now :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.