Я новичок в C++ и хочу показать матрицу с помощью MesasgeBox :: Show, но я не могу преобразовать String в System :: String, что мне нужно в качестве параметра. Вот мой кодПреобразование cv :: String в System :: String
projectionMatrices(Mat P1, Mat P2){
std::ostringstream stream;
for(int cols = 0; cols <= P1.cols; cols++){
for(int rows = 0; rows <= P1.rows; rows++){
stream << P1.at<double>(rows, cols) << '\t';
}
stream << '\n';}
String str = stream.str();
MessageBox::Show(str, "My Application", MessageBoxButtons::OKCancel, MessageBoxIcon::Asterisk);}
и вот ошибка:
1>MessageHandle.cpp(42): error C2665: 'System::Windows::Forms::MessageBox::Show' : none of the 21 overloads could convert all the argument types
1> c:\program files\reference assemblies\microsoft\framework\.netframework\v4.0\system.windows.forms.dll: could be 'System::Windows::Forms::DialogResult System::Windows::Forms::MessageBox::Show(System::String ^,System::String ^,System::Windows::Forms::MessageBoxButtons,System::Windows::Forms::MessageBoxIcon)'
1> c:\program files\reference assemblies\microsoft\framework\.netframework\v4.0\system.windows.forms.dll: or 'System::Windows::Forms::DialogResult System::Windows::Forms::MessageBox::Show(System::Windows::Forms::IWin32Window ^,System::String ^,System::String ^,System::Windows::Forms::MessageBoxButtons)'
1> while trying to match the argument list '(cv::String, const char [15], System::Windows::Forms::MessageBoxButtons, System::Windows::Forms::MessageBoxIcon)'
может кто-нибудь мне помочь, пожалуйста?
Вы уверены, что хотите преобразовать cv :: string в System :: String? Потому что, как я знаю, это C# формат для строки, а не стандартная строка (std :: string) в C++. – aisa