Results 1 to 4 of 4

Thread: using win or linux?

  1. #1
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default using win or linux?

    Hi,
    what should i do to know which OS my application is running on?
    I have to check if it's running on Windows or Linux machine, is there anything better then enum QSysInfo::WinVersion?
    thx

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: using win or linux?

    you can also use those preprocessor defines:

    http://doc.trolltech.com/4.3/qtglobal.html#Q_WS_X11

  3. #3
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: using win or linux?

    Use QSysInfo class

    Sorry didn't read post to the end
    Last edited by THRESHE; 19th March 2008 at 12:29.
    C++ & AMD forever

  4. #4
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: using win or linux?

    Quote Originally Posted by mattia View Post
    Hi,
    what should i do to know which OS my application is running on?
    I have to check if it's running on Windows or Linux machine, is there anything better then enum QSysInfo::WinVersion?
    thx
    Basically, your application should always be running on the OS on which it has been compiled (except for versions of course) so preprocessors should do here. Alternatively, if you don't want to mess with preprocessors everywhere just define a global method returning an enum (e.g {Linux, Mac, Windows, ...}) whose return value would be set through preprocessors. And finally, I doubt there is a clean method to determine whether the app might be running on an emulator (eg Wine...)
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. Replies: 19
    Last Post: 21st January 2008, 09:13
  2. Compiling Linux project on Mac
    By December in forum Newbie
    Replies: 2
    Last Post: 25th March 2007, 04:25
  3. Replies: 2
    Last Post: 12th January 2007, 11:19
  4. QT 3 (linux) to 4(windows XP)
    By deekayt in forum Qt Programming
    Replies: 1
    Last Post: 17th October 2006, 18:30
  5. Qt 4.1.2 Fails to build on Linux
    By rohandhruva in forum Installation and Deployment
    Replies: 6
    Last Post: 16th April 2006, 21:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.