我正在尝试使用带有两个参数的qDebug(),但每次都失败。
当我单独使用时没有问题,例如;
protected override void InitializeCulture()
{
if (Request.Form["DropDownList1"] != null)
{
String selectedLanguage = Request.Form["DropDownList1"];
UICulture = selectedLanguage ;
Culture = selectedLanguage ;
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(selectedLanguage);
Thread.CurrentThread.CurrentUICulture = new
CultureInfo(selectedLanguage);
}
base.InitializeCulture();
}
然而,当我将它们组合起来时,它会给出错误。
qDebug() << "img:width = " << img.width();
qDebug() << "img:height = " << img.height();
错误是:
qDebug() << "img:width = " << img.width() << "/t img:height = " << img.height() << std::endl;
我可以在qDebug中使用两个或更多参数吗?
修改::
如果删除error: no match for 'operator<<' in '((QDebug*)((QDebug*)((QDebug*)qDebug()().QDebug::operator<<(((const char*)"img:width = ")))->QDebug::operator<<(img.QImage::width()))->QDebug::operator<<(((const char*)"/t img:height = ")))->QDebug::operator<<(img.QImage::height()) << std::endl'
答案 0 :(得分:1)
删除行尾的std :: endl,std :: endl与std :: cout结合使用而不是qDebug()
这将有效:
qDebug() << "img:width = " << img.width() << "/t img:height = " << img.height();
答案 1 :(得分:0)
我认为您使用/t
代替\t
是问题(我想您正试图在两个项目之间放置一个标签)。加上是,不需要std :: endl。
qDebug() << "img:width = " << img.width() << "\t" << "img:height = " << img.height();
或者
qDebug() << "img:width = " << img.width() << "\t img:height = " << img.height();
应该有用。