Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default directory where new classes are stored?

I have a c++ project in Visual Studio 2010. if I right click my project in visual studio and select Add->Class, it will create a .h and .cpp file in the same directory where my .sln file is.

How can I set a different default folder where the created files should be stored?

like image 467
Mat Avatar asked Mar 14 '12 10:03

Mat


2 Answers

Prefix the class filename (and header filename) with the desired location relative the .sln project file.

To have Visual Studio create your class in your src directory:

  1. Type src/ in front of the filename. This will weirdly disappear (in VS2017 at least) but on hitting OK the files get put in the right place.

  2. In the Solution Explorer, drag the newly created files into the src (or desired) filter, this will update the project file (but won't move anything on disk).

enter image description here

like image 104
James Avatar answered Oct 08 '22 17:10

James


No, by default Visual Studio will put a new item in project's root.

like image 38
abatishchev Avatar answered Oct 08 '22 19:10

abatishchev