By default, CLion will add the following lines to a 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 can I configure CLion so that it uses #pragma once
by default for new header files?
Go to File-> Settings -> Editor -> File and Code Templates
. You will find there 3 tabs, namely, Templates
, Includes
, and Code
. Now under Templates
choose for example C Header File. Insert #pragma once
to replace its content. Now every time you add a new Header from project menu you will have your template.