1

我之前使用过这些宏:

#define TEXT_A   _T("a")
#define TEXT_B   _T("b")

std::wstring text = TEXT_A TEXT_B;      // then text = "ab"

现在我该怎么做:

#define TEXT_A   "a"
#define TEXT_B   "b"
std::wstring text = _T(TEXT_A TEXT_B);     // i need text be "ab" but failed.  and that error is wchar_t cannot connect with char.

我正在寻找一个宏来做到这一点。

4

1 回答 1

1

采用

std::wstring text = _T(TEXT_A) _T(TEXT_B);

甚至更好的解决方案:停止使用wstring.

于 2013-01-24T07:03:03.467 回答