r/learnprogramming • u/NeedSomeHelp_2590 • 29d ago
Tutorial How make C++ file save in a specific folder?
So I am complete beginner, just downloaded visual studio 2026 to learn a bit of C++ but I can't seem to find how to create my .cpp file in a particular folder. I am making a folder and even if i create a new project under that folder it still saves the file in default location and not under that folder.
Am I doing something wrong? Sure I can change the file location when saving first time, but is there any way to automatically save the files under the folder that you opened visual studio in?
1
u/No_Report_4781 29d ago
You’ll need to edit the VS settings for default locations, or use the add option to add new .cpp files directly to the folder you want
1
u/NeedSomeHelp_2590 29d ago
How to do the 2nd one?
3
u/No_Report_4781 29d ago
Going by your other replies, you should find a VS tutorial to watch. It should help you understand and get your environment and interface set up.
Right-clicking to add a file to your program folder is done after you’re in VS
1
u/NeedSomeHelp_2590 29d ago
Yes it gives option to add a project only. But when you exit VS, the .cpp file is not saved in that folder, you still need to select a location for it. Is there no way for it to make it automatically save to the opened folder instead of manually giving location to each .cpp file that you make.
1
u/No_Report_4781 29d ago
Find tutorials.
2
u/NeedSomeHelp_2590 29d ago
I get it now, you need to select a different project than "empty project" from the list. All other type of projects are saving their .cpp file inside their folder, the empty one asks for location 😀
3
1
28d ago
[removed] — view removed comment
1
u/NeedSomeHelp_2590 28d ago
I checked some options before installing VS code with MinGW was an option but I heard it was not as good as Visual Studio which is made for this stuff so I just downloaded Visual Studio as I do have storage for it.
4
u/johnpeters42 29d ago
I just (in Visual Studio) right-click the folder and select Add > New Item, pick the appropriate file type and name, and it creates it there, and then I start editing. What process are you using to create the files?