Thread: can someone tell me wat is the problem??

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    141

    can someone tell me wat is the problem??

    hi, i got an erro of this code, can someone please let me know the problem as the error said " undeclare invertedindex"

    Code:
    #include "inverted_index.h"
    #include "osdir.h"
    
    // InvertedIndex::tally
    //   Pre: a word and file pair as strings
    //   Post: adds the file to the index under word
     void InvertedIndex::tally(string word, string file) 
    {
         list.push_back(word);
         list.push_back(file);
    }
    
    ..........
    
    this is the main
    
    Code:
    
    #include <iostream>
    #include <cstdlib>
    #include "StringSet.h"
    #include <vector>
    
    int main() 
    {
    
      
      // test the InvertedIndex 
      InvertedIndex idx; //the error is here..
      idx.tally("hello", "hello.txt");
      idx.tally("hi", "hi.txt");
      idx.tally("no", "no.txt");
      idx.tally("lol", "lol.txt");
    
    
    
     
      system("PAUSE");
      return 0;
    }

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >can someone please let me know the problem as the error said " undeclare invertedindex"
    How does main know that InvertedIndex exists? Unless StringSet.h defines the type or includes inverted_index.h, it doesn't, and that's why it's complaining. I would imagine that the fix would be to include inverted_index.h in the source file where main is.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 05:46 PM