• Advertisement
Sign in to follow this  

cannot convert parameter 2 from 'ATL::CA2WEX' to 'LPCSTR'

This topic is 3310 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well, it will probably be familiar to you. Error: cannot convert parameter 2 from 'ATL::CA2WEX<>' to 'LPCSTR' In the following code: if(FAILED(D3DXCreateTextureFromFile(pd3dDevice, CA2W(matMaterials[i].pTextureFilename), &m_pMeshTextures[i]))) m_pMeshTextures[i] = NULL; Well now, by searching through this forum I learned that you have to change your character set. As specified in here: http://www.gamedev.net/community/forums/topic.asp?topic_id=489507 However, if I do that I get loads of other error concerning other places I use LPCSTR or LPCWSTR. For example: error C2664: 'D3DXLoadMeshFromXW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR' In the following code: // Load the mesh from the specified file hr = D3DXLoadMeshFromX( filename.c_str(), D3DXMESH_SYSTEMMEM, pd3dDevice, &ppAdjacencyBuffer, &pD3DXMtrlBuffer, NULL, &m_dwNumMaterials, &pMeshSysMem ); What to do what to do.. common sense tells me I have to start using the standard of one of those character sets. Easiest way would be to change what has caused the first error in the first place to correspond with the character set I was already using. Is that possible?

Share this post


Link to post
Share on other sites
Advertisement
You're mixing unicode strings with ascii strings in the same project. Pick one or the other and stick with it. If you want to use unicode, then use std::wstring instead of std::string. If you don't want to use unicode, then don't bother with the ATL string conversion stuff to begin with.

Share this post


Link to post
Share on other sites
Quote:
Original post by Driv3MeFar
You're mixing unicode strings with ascii strings in the same project. Pick one or the other and stick with it. If you want to use unicode, then use std::wstring instead of std::string. If you don't want to use unicode, then don't bother with the ATL string conversion stuff to begin with.


Thanks!

I discovered you can use CA2CT(stringtobeconverted) instead of CA2W(stringtobeconverted).

That did the trick! :D

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement