Jump to content
  • Advertisement
Sign in to follow this  
Taboen

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

This topic is 3558 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.pTextureFilename), &m_pMeshTextures))) m_pMeshTextures = 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
I agree with Driv3MeFar: pick a character set (preferably Unicode), and stick with it.

On a related note, I made a journal entry about Unicode and character sets a while back, which you might find somewhat useful.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!