I'm a complete beginner who recently installed Visual Studio 2026 to learn C++. I created a folder for my files and opened it with Visual Studio, but when I use the File menu to create a new file, the .cpp file remains unsaved until I close the program, and then Visual Studio asks me to choose a location. Is there a way to have new C++ files automatically saved in the folder I opened, or should I be creating a project and adding files differently?
3 Answers
You can also change Visual Studio’s default project and file locations in its settings, but that only controls where new projects are created. For individual .cpp files, use Add > New Item from the project’s Solution Explorer entry. Opening a folder by itself and creating a loose file does not necessarily make that folder the automatic save location.
The easiest approach is to create a Visual Studio project in the folder you want to use. Then, in Solution Explorer, right-click the project or its source-files folder, choose Add, then New Item, select a C++ file, and give it a name. Visual Studio will add and save the file in that project instead of treating it as a temporary unsaved document.
Where can I find the folder inside Visual Studio? I’m not seeing it in the editor.
For a beginner, the normal workflow is to create a C++ Console App project and choose your preferred folder when the project is created. Visual Studio then manages the project files and source files together, so you generally won’t have to pick a save location every time.

I usually right-click the folder in File Explorer and open it with Visual Studio, then use File > New File. I didn’t realize I needed to add the file through the project or Solution Explorer.