我无法在程序中声明字符串:
string MessageBoxText = CharNameTextBox->Text;
它就是行不通。它说string is undeclared identifier
。我在命名空间或包含或类似的东西中缺少什么?
确保您已包含此标头:
#include <string>
然后使用std::string
代替string
。这是因为string
定义于std
命名空间。
并且不要在命名空间范围内编写此内容:
using namespace std; //bad practice if you write this at namespace scope
然而,在函数范围内编写它并没有那么糟糕。但最好的是我之前建议的:
Use std::string
as:
std::string MessageBoxText = CharNameTextBox->Text;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)