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?
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:
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.
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).
No, by default Visual Studio will put a new item in project's root.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With