Class Folder Contents Gets Removed From Folders

Posted on 2006-04-11
Last Modified: 2010-04-01
I have a project that, for my own sanity, I have sub-divided my classes and files into different groups based on functionality.

Every once in a while, I will open the project to find that one or more classes have inexpicitly been moved to a different folder, removed from the folders altogether ( they are now just under the class folder), and rarely, ALL of the classes have been placed under the class folder.  Needless to say, this take 20 or 30 minutes to correct.  

Am I doing something wrong?  Is there a way to prevent this?

Thanks, Rick
Question by:rickatseasoft
    LVL 86

    Expert Comment

    What are you talking about? There is no such thing as a 'class folder' in C++. If you are referring to the VC++ IDE, just close the project, delete the .ncb file and open it again. Then, all the classes should be back again.
    LVL 48

    Expert Comment

    Unfortunately, information about subfolders in VC++ 6.0 project is not kept in .dsw or .dsp files. It is kept in one of files created automatically by VC++ IDE - .opt file. All files from this group (*opt, *.ncb, *.app, *.clw) are sometimes corrupted, in this case it is possible to remove them and VC++ creates then again. This is very old and well known VC++ IDE bug, and you cannot expect that project subfolders will be persistent. This feature is actually unusable.
    I can only suggest to make smaller projects or work with existing project without subfolders.
    LVL 39

    Expert Comment

    >>>> If you are referring to the VC++ IDE

    Actually, folders in VC IDE were stored in the project's workspace file *.dsw (VC6) or *.sln (VC7 and later). The *.ncb file is a binary cache  that might fake you if the workspace or solution file was changed by another user or by your configuration system. Then, the IDE may show you wrong folders means an older configuration while there is already a newer one in the workspace file.

    From your description I would say that doesn't apply. It seems just the opposite that you got a workspace from someone else that destroyed (overwrote) your personal workspace file. If using a configuration system like SourceSafe or ClearCase you should consider to put the workspace file under source control in order to avoid getting them overwritten by incidence. If not, make the workspace file read-only what should help.

    Regards, Alex

    Author Comment

    In the Workspace pane, there exists an Icon called  classes.  If you right click on Classes, it offers the opportunity to create a new folder.  In my project, there are numerous sub-classes of CEdit that perform special functions, and it suits my sense of organization to place them all in a folder called "SpecialEdits."  So, I simply right click on "Classes", create a folder called "SpecialEdits", and drag and drop these classes there.

    Right now, I have about 300 Classes stored in 7 folders.  Before I am done, I expect the numbers to reach 600-800 and 20 respectively.  Obviously, it is a real pain when VC++ throws the organization away, and just drops ALL of the classes into the heirarchy at the same level as the folders.

    In other words, it becomes:

    MyProject Classes
    as opposed to the way that I have it organized

    MyProject Classes
       + Folder1

    Regards, Rick

    Author Comment

    The previous comment was for jkr.


    In the most recent case, I simply did a save on the project to go play golf, and when I returned and tried to open it, all of my class folders were empty, and all of the classes were at the same level.


    Thanks for the information.  Would it be reasonable to upgrade to a newer version of the compiler, or is there some third-party software that will keep a project organized?  Had I known ahead of time that the folders were buggy, I could have named the classes in a uniform way that grouped them together in the list, but I didn't, and, for now, it is easier to occasionally, manually sort the classes into folders than it is to manually search the classes every time that I want to do something.
    LVL 48

    Accepted Solution

    I didn't try to make subfolders in VC++ 8.0, so I don't know whether it is better than 6.0 in this function. There are other 1000 reasons to upgrade to 8.0 - much better C++ compiler.
    BTW, 8.0 compiler shows Class View with namespaces, this can be great improvement instead of folders, using namespaces is highly recommended in large projects.
    LVL 48

    Expert Comment

    Maybe VC++ 6.0 Class View supports namespaces? I uninstalled it long time ago, so I can only guess.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
    This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
    The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now