编译错误“QImage with no type”在Qt4中
我怎样才能弄清楚如何解决这个错误消息?
我正在尝试将 Qt3 工作代码重写为 Qt4,以将 IplImage 转换为 QImage,并找到“正确的转换类型”,但是我的代码如下所示,导致“ISO C++ 禁止声明没有类型的“QImage” ” 编译消息。
QImage* convertIplImageToQImage(...){
...
QImage *qqImage;
if (this->data->nChannels == 1) {
QVector<QRgb> myColorTable;
for (int i = 0; i < 256; i++)
myColorTable.push_back(qRgb(i, i, i));
qqImage = new QImage(qImageBuffer, width, height,
QImage::Format_Indexed8);
} else {
qqImage = new QImage(qImageBuffer, width, height,
QImage::Format_RGB32);
}
return qqImage;
}
How can I figure out how to solve this bug message?
I am trying to rewrite a Qt3 working code into Qt4 for converting IplImage to QImage and found the "right conversion types" however my code as below results in "ISO C++ forbids declaration of 'QImage' with no type" compile message.
QImage* convertIplImageToQImage(...){
...
QImage *qqImage;
if (this->data->nChannels == 1) {
QVector<QRgb> myColorTable;
for (int i = 0; i < 256; i++)
myColorTable.push_back(qRgb(i, i, i));
qqImage = new QImage(qImageBuffer, width, height,
QImage::Format_Indexed8);
} else {
qqImage = new QImage(qImageBuffer, width, height,
QImage::Format_RGB32);
}
return qqImage;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查您是否将 #include 添加到您的 cpp 文件中。
如果缺少包含标头,我通常会收到此错误。
Check that you added #include to your cpp file.
I usually get this error if an include header is missing.