Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 851
becko Avatar asked Jul 22 '15 18:07

becko


People also ask

How do I get CLion to run?

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.

How do you run CLion step by step?

From the main menu, select Run | Force Step Over or press Alt+Shift+F8 .


1 Answers

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.

like image 135
Codoka Avatar answered Sep 18 '22 15:09

Codoka