采取以下措施:

highestScore->Data( ) // wchar_t *Platform::String::Data
startMenuItems.push_back( L"Highest score: " ); // startMenu is an array of wstring

我该怎么做?
startMenuItems.push_back( L"Highest score: " + highestScore->Data( ) );

我收到以下错误:
Error no operator "+" matches these operands
operand types are: const wchar_t[16] and const wchar_t*

最终在这里被使用:
virtual HRESULT CreateTextLayout(
  [in]   const WCHAR * string,
  UINT32  stringLength,
  IDWriteTextFormat * textFormat,
  FLOAT  maxWidth,
  FLOAT  maxHeight,
  [out]  IDWriteTextLayout ** textLayout
) = 0;

对于第一个参数...

最佳答案

试试这个:

startMenuItems.push_back(
    std::wstring(L"Highest score: ") + highestScore->Data());

您需要#include <string>

关于c++ - 如何将Platform ^字符串转换为wstring,然后与L字符串连接,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21769148/

10-15 04:10