开发者

Qt's pragma directives [closed]

开发者 https://www.devze.com 2022-12-16 14:31 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the开发者_运维知识库 question so it can be answered with facts and citations.

Closed 6 years ago.

Improve this question

Could anyone point me out to an article, where pragma directives, available in Qt environment would be discussed?


AFAIK pragma directives are preprocessor and compiler directives and have not much to do with Qt itself.

  • http://gcc.gnu.org/onlinedocs/cpp/Pragmas.html
  • http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
  • https://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/gcc/pragmas.html

Qt provides some defines, which can be used to do things like enable/disable parts of the source code depending on which platform you are compiling:

  • http://qt.nokia.com/doc/4.6/qtglobal.html

You can use them like this:

#ifdef Q_WS_MAC
  (some mac code goes here)
#endif

#ifdef Q_WS_WIN32
  (some windows code goes here)
#endif


The complete list of moduyles in Qt which can be removed by defines is found in src>corelib>global>qconfig-minimal.h in the folder of your original Qt download.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号