Create template-based files
CLion provides file templates for most of the supported languages. These templates help you create files with initial content already present.
There are four templates for C/C++: C++ Class, C++ Source File, C++ Header File, and C++ Module Interface Unit.

tip
To edit file templates, call Edit File templates from the Project view context menu or go to Settings | Editor | File and Code Templates.
In the Project tool window, select the directory in which you want to add new files. Right-click it and select New | C++ Class from the context menu.
Specify the name of the new class.
Use the default file type or choose from the drop-down list:
Click the spanner icon to access the default file extensions settings:
In the Namespace field, set the namespace for your class.
If you specify a nonexistent namespace, it will be created along with the new class.
tip
To create an unnamed namespace, type a blank space.
This field has basic validation checking for whether the identifier is a valid namespace name (or a blank space).
Select the Create header only checkbox if you want to create the header file only.
CLion can automatically add files to CMake targets.
Select the target from the list or click Add new target to create a new one. For more information, refer to Adding files to CMake projects.
In the Project tool window, select the directory in which you want to add new files. Right-click it and select New | C/C++ Source File from the context menu.
Specify the name of the new file.
Use the default file type or choose from the drop-down list:
Click the spanner icon to access the default file extensions settings:
Select the Create an associated header checkbox to create the corresponding header file as well.
CLion can automatically add files to CMake targets.
Select the target from the list or click Add new target to create a new one. For more information, refer to Adding files to CMake projects.
In the Project tool window, select the directory in which you want to add new files. Right-click it and select New | C/C++ Header File from the context menu.
Specify the name of the new file.
Use the default file type or choose from the drop-down list:
Click the spanner icon to access the default file extensions settings:
CLion can automatically add files to CMake targets.
Select the target from the list or click Add new target to create a new one. For more information, refer to Adding files to CMake projects.
Thanks for your feedback!