Thread: MSVC++ problem

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    267

    MSVC++ problem

    Hey, I've only been using MSVC++ for a few weeks now, and I really LOVE all of the handy features, especially the ClassView tree.... however, for some reason, two member functions don't show up in the ClassView tree or in the member list... EVEN THOUGH the members function perfectly, I use them and they work..... so I don't see any reason why in the ClassView and member list they aren't there.....

    Here's the code... could you tell me if there's something I've done which causes MSVC++ to do this? Because I can't figure it out......

    PHP Code:
    #ifndef _SLList_H
    #define _SLList_H

    #ifndef NULL
    #define NULL 0
    #endif

    template <class T>
    struct Node
    {
        
    Node<T>* next;
        
    T data;
    };

    template <class T>
    class 
    SLList
    {
        private:
            
    Node<T>* head, *curr;
            
    int length;

        public:
            
    SLList() { head curr NULLlength 0; }
            ~
    SLList() { while (length 0remove_back(); }
            
    int getlength() { return length; }
            
    void add_back(T);
            
    void remove_back();
    };

    template <class T>
    void SLList<T>::add_back(T data)
    {
        
    Node<T>* newNode = new Node<T>;

        if (
    length == 0)
            
    head curr newNode;

        
    curr->next newNode;
        
    newNode->data data;
        
    newNode->next NULL;
        
    curr newNode;
        
    length += 1;
    }

    template <class T>
    void SLList<T>::remove_back()
    {
        
    curr head;
        if (
    curr->next == NULL)
        {
            
    delete curr;
            
    head curr NULL;
            
    length -= 1;
            return;
        }

        while ((
    curr->next)->next != NULL)
            
    curr curr->next;
        
    delete (curr->next);
        
    curr->next NULL;
        
    length -= 1;

    }

    #endif 
    Last edited by d00b; 07-23-2002 at 09:15 AM.

  2. #2
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    here's a picture of what I mean, it ignores add_back(), and remove_back()

    ???

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Say hello to your first VC++ bug...

    Close the project ....go to your project files......find the .opt & .ncb files and delete them (or rename if you a cautious type )....then reporn the project.......the classes should reappear on classview...


    That worked for me

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by d00b
    Oh! it worked! Thanks alot!

    *glances at signature*
    lol
    Oh come on...its just a little bug!!!! And now you know the solution it will not be much of a problem. VC++ wont have any less bugs than similar compilers......in fact is stomps on 1 or 2 I know

    And big Bill did use the word "Generally"..........but then this guy also gave us WinME....so hmm......

    :: edit...hey where did that last post go...more bugs I guess ::

  5. #5
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    It didn't work... when I deleted those files, the ClassView window reloaded all of the files and classes, and they still don't show up, I get the same thing....

    If you copy the code into a workspace, does everything show up for you?

    I'm basically curious if this is a bug with VC++, or if it's something I did in code that's causing VC++ to do this...

    ???
    Last edited by d00b; 07-23-2002 at 09:30 AM.

  6. #6
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by d00b
    It didn't work... when I deleted those files, the ClassView window reloaded all of the files and classes, and they still don't show up, I get the same thing....

    ???
    Maybe its because those functions are defined in the header and not the cpp file???

  7. #7
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    strange! When I make the functions inline... they show up! wtf?

  8. #8
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by d00b
    strange! When I make the functions inline... they show up! wtf?
    usually if you define the function inside the classblock of the header (you can do this in small funcs) they are automatically inline.....

    Anything else should go in a cpp file

    I guess VC++ thinks on those lines

  9. #9
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    ok yeah you're right...... I feel like an idiot! *bang*

    I have no excuse for doing something that stupid, I just got so set on there being an error

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MSVC 2005 problem
    By l2u in forum Windows Programming
    Replies: 1
    Last Post: 05-13-2006, 05:30 PM
  2. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  3. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  4. MSVC Tutorial problem - Monochrome Palette
    By colinH in forum C++ Programming
    Replies: 4
    Last Post: 10-30-2002, 03:57 AM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM