Thread: Do you know what this compiler error means?

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    32

    Question Do you know what this compiler error means?

    The following set of 3 files compile just fine when it is one program and I DO NOT use a class. When I broke it up into 3 files my compiler gets very angry with me.

    The program sorts using linked lists( at least it does without the class and 3 files)

    I looked up the error in the MS Knowledge base but do not understand what it means:

    http://support.microsoft.com/default...b;en-us;226110

    I am using MS Visual C++ 6.0 on Windows XP. When I compile I get the following error:

    Code:
    --------------------Configuration: aaa - Win32 Debug--------------------
    Compiling...
    qwert.cpp
    C:\Program Files\Microsoft Visual Studio\MyProjects\aaa\qwert.cpp(14) : fatal error C1001: INTERNAL COMPILER ERROR
            (compiler file 'msc1.cpp', line 1794) 
             Please choose the Technical Support command on the Visual C++ 
             Help menu, or open the Technical Support help file for more information
    Error executing cl.exe.
    
    qwert.obj - 1 error(s), 0 warning(s)
    I have the following 3 files:

    FILE1: main.cpp
    Code:
    #include"qwert.h"
    #include<iostream.h>
    
    void main ()
    {
        sort  sortClass;
        node* head;
        char   i;
    
        cout << "Enter first letter (0 to stop): ";
        cin >> i;
    
        while(i != 'z')
       {
            head = sortClass.sortedinsert(head, i);
            cout << "Enter next letter (0 to stop): ";
            cin >> i;
        }
    
        cout << "You entered these letters:" << endl;
        sortClass.displaylist(head);
    }

    FILE2: qwert.cpp
    Code:
    #include"qwert.h"
    #include<iostream.h>
    
    //----------------------------------------------
    
    sort::sort()
    {
    	cout << "Constructor Called" << endl;
    	head = NULL;
    }
    
    //----------------------------------------------
    
    sort::~sort()
    {
    	cout << "Destructor Called" << endl;
                    delete head;
    	head = NULL;
    }
    
    //----------------------------------------------
    
    void sort::displaylist(node*& head_ptr)
    {
    	while(head_ptr != NULL)
    	{
    		cout << head_ptr->data << " ";
    		head_ptr = head_ptr->next;
    	}
    
    	cout << endl;
    }
    
    //----------------------------------------------
    
    node* sort::sortedinsert(node*& head, char data)
    {
    	node *newNode;
    
    	// populate the new node that we're adding.
    	newNode = new node;
    	newNode->data = data;
    	newNode->next = NULL;
    
    	// figure out where to add that node in
    	if((head == NULL) || (head->data >= newNode->data))
    	{
    		// this element should go at the head of the list
    		newNode->next = head;
    		head = newNode;
    	}
    	else	// this is not the first element in the list
    	{
    		// create a pointer that will traverse the list to find where to insert the new element
    		node* current;
    		current = head;
    
    		// move current down the list till we find where our new node is supposed to go
    		while((current->next != NULL) && (current->next->data < newNode->data))
    		{
    			current = current->next;
    		}
    		newNode->next = current->next;
    		current->next = newNode;
    	}
    	return head;
    }

    FILE3: qwert.h
    Code:
    struct node
    {
        char  data;
        node* next;
    };
    
    //----------------------------------------------
    
    class sort
    {
    	private:
    		node* head;
    	public:
    		sort();
    		~sort();
    		void displaylist(node*& head);
    		node* sortedinsert(node*& head, char data);
    };
    I hope someone knows what I am doing wrong.
    Last edited by Zalbik; 02-26-2003 at 06:07 PM.

  2. #2
    Your main file would need to include qwert.cpp. But I had the same problem one time, I guess the compiler had a hiccup. But mine was because of an error on my part and the compiler was 'confused'. But my sis needs the computer, I'll try looking over the code when I get a chance.

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    32
    Actually the hiccup mention helped me out. Assuming this possible, I shut down the computer; Rebooted and now it works. Im guessing my playing with dynamic memory and not deallocating it killed my computer.

    Sometime it takes someone else to suggest the simplest solutions...Thanks

    Well...at least the boards have another example on Linked Lists and sorting.
    Last edited by Zalbik; 02-26-2003 at 04:30 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  2. Compiler Paths...
    By Cobra in forum C++ Programming
    Replies: 5
    Last Post: 09-26-2006, 04:04 AM
  3. C Compiler and stuff
    By pal1ndr0me in forum C Programming
    Replies: 10
    Last Post: 07-21-2006, 11:07 AM
  4. I can't get this new compiler to work.
    By Loduwijk in forum C++ Programming
    Replies: 7
    Last Post: 03-29-2006, 06:42 AM
  5. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 11:28 AM