Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Problem building - error: 'windowsVersion' is not a member of 'QSysInfo'
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 2 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    thiroc80
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      Welcome to DevNet!

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

      1 Reply Last reply
      0
      • T Offline
        T Offline
        thiroc80
        wrote on last edited by
        #3

        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 "";
        }@

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andreyc
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            thiroc80
            wrote on last edited by
            #5

            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! =)

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved