Problem building - error: 'windowsVersion' is not a member of 'QSysInfo'



  • Hi,

    I'm new to this and yesterday began to work on a new C++ project, but I wasn't able to build it so far to get some tests running in my computer. It should be all ok with the code since it runs in my colleague's computer.

    Below are some of the lines in which the error appear, and the error message.

    @
    if ((QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8) &&
    (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS8_1))
    qDebug () << "win 8";
    @

    @54: error: 'windowsVersion' is not a member of 'QSysInfo'
    if ((QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8) &&
    ^
    @

    Does anyone have an idea of where the problem is? It's like the defines in the qsysinfo.h are not being made. I'm using Archlinux, and my colleague's pc is running Ubuntu.



  • Welcome to DevNet!

    This function is "available":http://qt-project.org/doc/qt-5/qsysinfo.html#windowsVersion only for Windows build of Qt.



  • Thanks!

    I figured it could be something like that. But it did run in my colleague's linux, so I am a bit confused and thought it may be something with my configs.

    Here's the full method:
    @std::string CACIC_Computer::getOS(){
    QString text;
    QStringList environment = QProcess::systemEnvironment();
    foreach (text, environment) {
    if (text.contains("OS=", Qt::CaseInsensitive)){
    if ((QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8) &&
    (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS8_1));
    // qDebug () << "win 8";
    else if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8_1)
    // qDebug() << "win 8.1";
    return text.mid(text.indexOf("=")+1).toStdString();
    }
    //implement if for linux.
    }
    return "";
    }@



  • These functions are hidden if Q_OS_WIN or Q_OS_CYGWIN are not defined.

    • qsysinfo.h
      @
      ...
      #if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN)
      ...
      static const WinVersion WindowsVersion;
      static WinVersion windowsVersion();

    #endif
    ...
    @

    The question is how did you and your colleague build Qt and the app.



  • I guess I'll just have to wait him, and see if he did some wizardry on how to build it.

    Thanks for the quick answers anyway! =)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.