How to force CLion to use "#pragma once" instead of "ifndef ... def ..." by default for new header files?

By default, CLion will add the following lines to the newly created header file:

#ifndef SOME_NAME_H #define SOME_NAME_H .... your code here #endif //SOME_NAME_H 

But I like #pragma once more. How to configure CLION to use #pragma once by default for new header files?

+7
include header-files pragma clion
source share
1 answer

Go to File-> Settings -> Editor -> File and Code Templates . You will find 3 tabs there, namely Templates , Includes and Code . Now under Templates select, for example, C Header File. Insert #pragma once to replace its contents. Now every time you add a new title from the project menu, you will have your own template.

+8
source share

All Articles