Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

One the way to precompiled header



  • Be cause the MSVC compiling is very very slow, I try to integrate pchs.

    Here my pro-file

    CONFIG += precompile_header
    PRECOMPILED_HEADER = stable.h
    HEADERS += stable.h

    Here is my stable.h

    #ifndef MYPCH
    #define MYPCH
    #include <compilersettings.h>
    #include <qtgeneral.h>
    #endif // MYPCH

    Now I, have a problem with compiler warnings. I have had disabled it in a header file compilersettings.h

    // ************** unused parameter
    #pragma warning(disable: 4100)
    // ************** local variable initialized but unused
    #pragma warning(disable: 4189)

    This work without pchs fine but not with pchs. I get some hounded of warnings now.

    I tried it to set compiler flags
    QMAKE_CXXFLAGS += /wd4100
    QMAKE_CXXFLAGS += /wd4189
    but that has no effect.

    So my questions are, how to set the MSVC compiler flags correct and why works my compilersettings.h not with pchs?


Log in to reply