Я получаю ошибку компиляции в строке «сопзЬ wchar_t *» до «LPCTSTR» в MFC/C++:Невозможно преобразовать параметр 1 из проекта
MessageBox(e.getAllExceptionStr().c_str(), _T("Error initializing the sound player"));
Error 4 error C2664: 'CWnd::MessageBoxA' : cannot convert parameter 1 from 'const wchar_t *' to 'LPCTSTR' c:\users\daniel\documents\visual studio 2012\projects\mytest1\mytest1\main1.cpp 141 1 MyTest1
Я не знаю, как разрешить эту ошибку, я попробовал следующее:
MessageBox((wchar_t *)(e.getAllExceptionStr().c_str()), _T("Error initializing the sound player"));
MessageBox(_T(e.getAllExceptionStr().c_str()), _T("Error initializing the sound player"));
Я использую параметр «Использовать Multi-Byte Character Set», и я не хочу, чтобы изменить его.
Я не уверен, почему 'getAllExceptionStr' возвращает большую строку, если вы застряли с ANSI, но тогда вам придется * конвертировать * (примечание: не делать). – chris