Important: Please read the Qt Code of Conduct -

Qt Creator: How do I switch pragma-style header guard to "old-style" include guards when generating a new header file?

  • I recently noticed that the automatically generated header guards use #pragma once instead of #ifndef MYFILE_H... How do I get the old functionality back?

    I found the wizard files (Tools/QtCreator/share/qtcreator/templates/wizards) and found that I could edit them to get the correct behavior, but that seems hacky as there is already a variable Cpp:PragmaOnce (see wizards/classes/cpp/file.h for an example) that seems to dictate which guard is used. The only issue is that I don't know how to set this variable. Is there a place to set this in the Qt Creator GUI?

  • 0_1557645113649_ed035a77-f887-4904-b2ce-634ffa44f07f-image.png

Log in to reply