【问题标题】:Compile error "QImage with no type" in Qt4在 Qt4 中编译错误“QImage with no type”
【发布时间】:2011-06-26 13:23:39
【问题描述】:

我怎样才能弄清楚如何解决这个错误消息?

我正在尝试将 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;

  }

【问题讨论】:

    标签: qimage qt3 qt4.7


    【解决方案1】:

    检查您是否将#include 添加到您的cpp 文件中。 如果缺少包含标头,我通常会收到此错误。

    【讨论】:

    • 感谢 Elle 的建议,效果很好,但现在有其他问题要解决,再次感谢!
    猜你喜欢
    • 2021-01-15
    • 2018-10-20
    • 1970-01-01
    • 2020-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多