CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2012
    Location
    MD
    Posts
    44

    VS C++ Express directories/disk layout/structure

    I had previously attempted to put all my VS C++ stuff on my D data partition. It seems I have 4 projects out there.

    But, it looks like I have one project that's partly on C and partly on D.


    D:\Libraries\Documents\Visual Studio\projects

    which has 4 directories underneath it for each project/solution and all looks good and makes sense. No problem. All .cpp and .exes are inside the Debug and Release directories under each project directory name.


    This is my problem project:

    C:\users\jim\Documents\Visual Studio\Projects\test\

    But the source .cpp file is called "System Image" as I wish it to be yet it's inside a \test directory. The .exe is inside that \test directory in the \Release directory. Confusingly, there's ANOTHER test directory under the \test directory that also has a Debug directory. No idea why.

    So, I need to have someone explain the layout of what VS C++ does. For example, Tools --> Options (Projects and Solutions, GENERAL tab) has everything pointing to D: . Do these options come into play ONLY when you "create a new project/solution"? In other words, I have 4 projects seemingly laid out as I wish. Is the Tools -> Options reflecting the currently opened project/solution or is it a true "option" that WOULD be applied to all future project/solution creations?

    What's the best way for me to redo this "System Image" project to get all of it on D:? Simply save the only source file (System Image.cpp), delete the "test" project (yet the .sln file is called System Image.sln) and make sure everything is off C: ? Then create a new Project/Solution and make sure a System Image directory gets created in the correct place on D: so I know I'm doing it correctly? Then cut/paste the System Image.cpp into the editor and save it as System Image?

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: VS C++ Express directories/disk layout/structure

    As far as I know Tools --> Options specifies the paths for future projects.

    The best way to place the project files where you want them is to create the project at the correct location or move an existing one. Stray Debug and Relase folders from your other attempts can safely be deleted. Source files that has been added with incorrect path is removed from the project (don't delete the actual file!), moved to the correct place and then readded to the project.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  3. #3
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: VS C++ Express directories/disk layout/structure

    Quote Originally Posted by jlewand61 View Post
    So, I need to have someone explain the layout of what VS C++ does. For example, Tools --> Options (Projects and Solutions, GENERAL tab) has everything pointing to D: . Do these options come into play ONLY when you "create a new project/solution"? In other words, I have 4 projects seemingly laid out as I wish. Is the Tools -> Options reflecting the currently opened project/solution or is it a true "option" that WOULD be applied to all future project/solution creations?
    No, these settings have nothing to do with your projects or solutions.
    There are two types of files you need to know about (besides the files you create to write your code). Solution files (*.sln) hold a collection of projects. Project files (*.vcproj or *.vcxproj) hold a collection of files with code and the project settings. All the project settings can be controlled from the project properties. Both the solution files and project files are just XML files, so you can also easily open them to see e.g. the relative path to the source files included in your project. All the other files created by VS (including the entire Debug and Release folders) can be safely deleted.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  4. #4
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: VS C++ Express directories/disk layout/structure

    To add to what the other posters already stated correctly...

    Quote Originally Posted by jlewand61 View Post
    But the source .cpp file is called "System Image" as I wish it to be yet it's inside a \test directory. The .exe is inside that \test directory in the \Release directory. Confusingly, there's ANOTHER test directory under the \test directory that also has a Debug directory. No idea why.
    This is something that irritates VC++ users every once in a while. When you create a new project and leave the settings in the creation dialog mostly at their default values (e.g. just enter your project name and pick the appropriate project type), you're actually creating a new project along with an enclosing new solution of the same name. In your case,


    C:\users\jim\Documents\Visual Studio\Projects\test\


    is the solution directory, mainly containing the .sln file, one (or more, if you add some later) project directories and the output directories (see below), and


    C:\users\jim\Documents\Visual Studio\Projects\test\test\


    is the actual project directory, containing, among other things, the .vcproj or .vcxproj file and the source fies.

    The Debug and Release directories at the solution level are the output directories which should contain the .exe (and .pdb) files, while the directories of the same names at the project level contain intermediate files that you'll hardly ever need to touch yourself at all.
    Last edited by Eri523; October 30th, 2012 at 09:34 PM.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  5. #5
    Join Date
    Feb 2012
    Location
    MD
    Posts
    44

    Re: VS C++ Express directories/disk layout/structure

    I looked at the .sln file and see that it DOES point to the D:\ directory as it should. So, it's some kind of hybrid, half-residing in c:\users\jim and half on D:\Libraries\Documents\Visual Studio.

    So, it looks like my source code is on D: but the .exe is on C:.

    I guess I should just save off the .cpp file, delete this project/solution (\test) and then create a "Sysimage" one and check that it all gets put on D and doesn't touch C:\users\jim at all.

  6. #6
    Join Date
    Feb 2012
    Location
    MD
    Posts
    44

    Re: VS C++ Express directories/disk layout/structure

    *sigh*

    I created a new project/solution called "verify". All directories were put on D and not a stitch on C. So far, so good.

    I then deleted "verify" project using the left-hand Solution Explorer pane. I see that all the stuff is still on D. I don't know how you delete a solution vs. a project.

    I also still don't quite understand why where's a debug and release directory in \verify but the next \verify\verify directory ALSO has debug and release folders.

  7. #7
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: VS C++ Express directories/disk layout/structure

    Yes a VS project have a disk structure like:
    Code:
    ...\Project
            Project.sln ...
            Debug
                    Project.exe ...
            Release
                    Project.exe ...
            Project
                    stdafx.cpp / h
                    file1.cpp
                    project.vcxproj ...
                    Debug
                            stdafx.obj ...
                    Release
                            stdafx.obj ...
    so those folders are normal.

    A solution is kind of a container that holds all projects that are needed to build the final application. Let's say that you have some kickass library that you use in all your applications. You can of course link that library to the application by adding the path and so on to your application solution but what if you want to easily edit both your application source and the library source from the same IDE?

    The solution() is to add the library project to your application solution and set the application project to depend on the library. Now you easily debug and fix both projects from the same IDE. Every time you build the application the library project also gets built if it has been changed. You don't have to remember to do that yourself.

    So, when you delete a project from a solution you just delete the reference to it. The project files are left alone as they might be referenced by another solution.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  8. #8
    Join Date
    Feb 2012
    Location
    MD
    Posts
    44

    Re: VS C++ Express directories/disk layout/structure

    Does one have to manually delete the folder structure as technically there's no way to delete a SOLUTION that I can find.

  9. #9
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: VS C++ Express directories/disk layout/structure

    Yes as far as I know you have to delete a solution by deleting the folder.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured