I'm running "QUdpSocket::ShareAddress" on my QT application but ShareAddress is ignored by windows. So I'm trying to solve this problem by identifying OS at run time. I heard a couple of information about window version indentifier but I couldn't see any solution to solve my problem. If there is any of advice, it would be very appreciated. Thanks.
+10
A:
#include <QtGlobal>
...
#ifdef Q_OS_MAC
// mac
#endif
#ifdef Q_OS_LINUX
// linux
#endif
#ifdef Q_OS_WIN32
// win
#endif
See QtGlobal documentation for further information.
kemiisto
2009-11-09 07:52:00
Thanks for your help. I'll try it right now.
KIM
2009-11-09 08:08:18
It does work. I found items for C++ also. Thanks.
KIM
2009-11-09 08:36:59
+1
A:
It isn't always the most elegant solution, but it's definitely effective to use a preprocessor definition to check platform at compile time.
Example:
#ifdef _WIN32
#endif
Drakonite
2009-11-09 07:58:54