Alex Rivera | Logout

VC2010 C++ - organizing source files

Asked 2011-03-16T05:26:44.463
74

I had some questions about how to organize source files in a VC 2010 C++ project. The default filters that are included won't be sufficient as ultimately, I'm going to have a lot of .cpp and .hpp files so it's going ot be messy. I'd like to create a folder at the root of the project called "source" then create folders inside "source" for the various source file categories I'd like to use. When I right click the solution, I only get the option to add a filter, not a folder. I can create folders manually in windows explorer, then include them, but Then I lose my ability to add filters. Is there a way to add new folders (without using windows explorer) and still use filters?

Additionally, is there something similar to $(CURDIR) that I could use to include the source file folder without needing an absolute path?

Edit
Report

1 Answer

25

It actually IS possible to view (and manipulate) the physical file structure via Visual Studio, as described in this SO post:

Header/Source file is not an requirement imposed by Visual Studio. That's just the default layout, and it's virtual, not physical. If you click "Show all files" in the solution explorer, it will show the folder tree as it is on the hard drive- which you can manipulate as you see fit.

answered 2013-01-22T18:11:31.017

Your Answer