When I try to create a new C++ class by right-clicking anywhere in the Solution Explorer, Add -> Class
, it creates an empty .h
file (no #pragma once
) and there is no .cpp
file. This is happening across all my C++ projects, which include cmake projects and generic console applications (all Windows). I am using Visual Studio 2022 Community 17.13.5.
I have tried repairing, updating, and reinstalling Visual Studio through the installer.
How can I fix this?
When I try to create a new C++ class by right-clicking anywhere in the Solution Explorer, Add -> Class
, it creates an empty .h
file (no #pragma once
) and there is no .cpp
file. This is happening across all my C++ projects, which include cmake projects and generic console applications (all Windows). I am using Visual Studio 2022 Community 17.13.5.
I have tried repairing, updating, and reinstalling Visual Studio through the installer.
How can I fix this?
Share Improve this question edited Mar 27 at 18:05 Remy Lebeau 601k36 gold badges507 silver badges851 bronze badges asked Mar 27 at 10:10 StyderStyder 1 2- 2 This is the one case where a screenshot of the "add class" dialog would actually help. – Botje Commented Mar 27 at 13:17
- 1 Not all classes need a /.cpp file. Some are implemented purely in the header file. Perhaps that's the assumption and there's a way to subsequently add a implementation file? – Jesper Juhl Commented Mar 27 at 20:17
1 Answer
Reset to default 0I found the solution by going to Tools -> Import and export settings -> reset all settings -> then I reset both general and visual C++