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?
From the main menu, select Run | Show Running List. In the top-right corner of the editor, CLion shows a list with all active applications.
From the main menu, select Run | Force Step Over or press Alt+Shift+F8 .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With