Qt 5.8中的Qt 5.5项目构建错误 [英] Qt 5.5 project build error in Qt 5.8

查看:428
本文介绍了Qt 5.8中的Qt 5.5项目构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Qt 5.5上开发一个简单的应用程序.由于Qt 5.5没有 QChart 类功能,因此我必须安装和构建我在5.8发行版上的Qt 5.5项目.对于我的项目,我正在使用名为 QXlsx 的第三方软件来创建和编辑Excel电子表格.该库在Qt 5.5中运行正常,但无法在Qt 5.8版本上进行编译.编译返回以下错误;

I was developing a simple application on Qt 5.5. Since Qt 5.5 does not have QChart class features, I had to install and build my Qt 5.5 project on the 5.8 distribution. For my project I am using this 3rd party software called the QXlsx to create and edit Excel spreadsheets. This library was working flawlessly in Qt 5.5 but fails to compile on the Qt 5.8 version. The compilation returns the following error;

/Users/Vino/Documents/My Stuff/Qt Projects/Fundemental Analysis/FundementalAnalysis/3rdparty/qtxlsx/src/xlsx/xlsxzipreader.cpp:52: error: implicit instantiation of undefined template 'QVector<QZipReader::FileInfo>' QList<QZipReader::FileInfo> allFiles = m_reader->fileInfoList(); ^ 我不确定这意味着什么,但是我很有信心,因为该库以前在Qt 5.5上可以使用,所以不必对该库的源代码进行任何更改.

/Users/Vino/Documents/My Stuff/Qt Projects/Fundemental Analysis/FundementalAnalysis/3rdparty/qtxlsx/src/xlsx/xlsxzipreader.cpp:52: error: implicit instantiation of undefined template 'QVector<QZipReader::FileInfo>' QList<QZipReader::FileInfo> allFiles = m_reader->fileInfoList(); ^ I am not sure what it means, but I am quite confident that I don't have to make any changes on the source code of this library since it worked previously on Qt 5.5.

无论如何这是发生错误的源代码

Anyway this is the source code where the error occurs

#include "xlsxzipreader_p.h"
#include <private/qzipreader_p.h>



namespace QXlsx {

    ZipReader::ZipReader(const QString &filePath) :
    m_reader(new QZipReader(filePath))
    {
         init();
    }

    ZipReader::ZipReader(QIODevice *device) :
    m_reader(new QZipReader(device))
    {
         init();
    }

    ZipReader::~ZipReader()
    {

    }

    void ZipReader::init()
    {
           QList<QZipReader::FileInfo> allFiles = m_reader->fileInfoList();
           foreach (const QZipReader::FileInfo &fi, allFiles) {
           if (fi.isFile)
                 m_filePaths.append(fi.filePath);
    }
}

     bool ZipReader::exists() const
     {
           return m_reader->exists();
     }

    QStringList ZipReader::filePaths() const
    {
       return m_filePaths;
    }

    QByteArray ZipReader::fileData(const QString &fileName) const
    {
         return m_reader->fileData(fileName);
    }
}// namespace Xlsx

此功能发生错误;

    void ZipReader::init()
    {
         QList<QZipReader::FileInfo> allFiles = m_reader->fileInfoList();
         foreach (const QZipReader::FileInfo &fi, allFiles) 
         {
              if (fi.isFile)
              m_filePaths.append(fi.filePath);
         }
    }

因此,作为解决方案,我尝试自源代码中添加 #include <QList> QList <使用指定标头引用了strong> ,但这不能解决问题 . 当我添加 #include <QList>时, 出现了许多新的错误.如何建立这个专案?

So as a solution I tried adding #include <QList> to the source code since QList is referenced with specifying the header but this does not resolve the issue. When I added #include <QList>, a new myriad of errors popped up. How can I build this project?

推荐答案

所以我解决了我的问题;我使用的是最旧的QXlsx版本,并且根据此帖子,gitHub上有许多新修订.安装新版本可以解决该问题.

So I fixed my problem; I was using the oldest version of the QXlsx, and according to this post, there were many new revisions on gitHub. Installing the new version solved the issue.

新版本
旧版本

这篇关于Qt 5.8中的Qt 5.5项目构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆