c++qtc-preprocessorpragma

Qt's pragma directives


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


Solution

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

    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:

    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