Thread: help, templates and hashing, and yucky stuff like that

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    43

    Question help, templates and hashing, and yucky stuff like that

    i am having some serious problems with this project...
    here are my errors, code will be attached, any help will be much appreciated

    In file included from proj5.cpp:26:
    HashMap.h:28: `KeyType' was not declared in this scope
    HashMap.h:28: parse error before `)'
    HashMap.h:34: `KeyType' was not declared in this scope
    HashMap.h:34: parse error before `,'
    HashMap.h:36: `KeyType' was not declared in this scope
    HashMap.h:36: parse error before `)'
    HashMap.h:38: `KeyType' was not declared in this scope
    HashMap.h:38: parse error before `,'
    HashMap.h:40: syntax error before `('
    HashMap.h:42: `KeyType' was not declared in this scope
    HashMap.h:42: parse error before `)'
    HashMap.h:45: non-template type `HashMap' used as a template
    HashMap.h:45: ANSI C++ forbids declaration `hm' with no type
    HashMap.h:47: `KeyType' was not declared in this scope
    HashMap.h:47: parse error before `)'
    HashMap.h:51: syntax error before `*'
    In file included from HashMap.h:55,
    from proj5.cpp:26:
    HashMap.cpp:2: non-template type `HashMap' used as a template
    HashMap.cpp:2: parse error before `{'
    HashMap.cpp:11: syntax error before `*'
    HashMap.cpp:12: ANSI C++ forbids declaration `buckets' with no type
    HashMap.cpp:12: parse error before `*'
    HashMap.cpp:13: syntax error before `<='
    HashMap.cpp:13: syntax error before `++'
    HashMap.cpp:18: ANSI C++ forbids declaration `hashfunc' with no type
    HashMap.cpp:18: `h' was not declared in this scope
    HashMap.cpp:19: parse error before `}'
    HashMap.cpp:23: destructors must be member functions
    HashMap.cpp:23: definition provided for explicit instantiation
    HashMap.cpp:23: template-id `HashMap<>' for `HashMap()' does not match any templ
    ate declaration
    HashMap.cpp:23: syntax error before `{'
    HashMap.cpp:24: syntax error before `<='
    HashMap.cpp:24: syntax error before `++'
    HashMap.cpp:32: definition provided for explicit instantiation
    HashMap.cpp:32: non-template used as template
    HashMap.cpp:32: syntax error before `{'
    HashMap.cpp:35: syntax error before `*'
    HashMap.cpp:40: syntax error before `->'
    HashMap.cpp:41: syntax error before `->'
    HashMap.cpp:42: invalid type argument of `unary *'
    HashMap.cpp:42: `key' was not declared in this scope
    HashMap.cpp:42: ANSI C++ forbids declaration `buckets' with no type
    HashMap.cpp:42: `newptr' was not declared in this scope
    HashMap.cpp:42: assignment (not initialization) in declaration
    HashMap.cpp:43: parse error before `return'
    HashMap.cpp:47: definition provided for explicit instantiation
    HashMap.cpp:47: non-template used as template
    HashMap.cpp:47: syntax error before `{'
    HashMap.cpp:49: syntax error before `*'
    HashMap.cpp:50: ANSI C++ forbids declaration `front' with no type
    HashMap.cpp:50: invalid type argument of `unary *'
    HashMap.cpp:50: `key' was not declared in this scope
    HashMap.cpp:51: ANSI C++ forbids declaration `back' with no type
    HashMap.cpp:52: parse error before `if'
    HashMap.cpp:65: ANSI C++ forbids declaration `front' with no type
    HashMap.cpp:65: redefinition of `int front'
    HashMap.cpp:50: `int front' previously defined here
    HashMap.cpp:65: base operand of `->' is not a pointer
    HashMap.cpp:66: parse error before `}'
    HashMap.cpp:71: definition provided for explicit instantiation
    HashMap.cpp:71: non-template used as template
    HashMap.cpp:71: syntax error before `{'
    HashMap.cpp:80: ANSI C++ forbids declaration `runner' with no type
    HashMap.cpp:80: base operand of `->' is not a pointer
    HashMap.cpp:81: parse error before `}'
    HashMap.cpp:86: non-member function `Find(KeyType)' cannot have `const' method q
    ualifierHashMap.cpp:86: definition provided for explicit instantiation
    HashMap.cpp:86: non-template used as template
    HashMap.cpp:86: syntax error before `{'
    HashMap.cpp:94: ANSI C++ forbids declaration `runner' with no type
    HashMap.cpp:94: redefinition of `int runner'
    HashMap.cpp:80: `int runner' previously defined here
    HashMap.cpp:94: base operand of `->' is not a pointer
    HashMap.cpp:95: parse error before `}'
    HashMap.cpp:97: parse error before `throw'
    HashMap.cpp:102: non-member function `Has(KeyType)' cannot have `const' method q
    ualifier
    HashMap.cpp:102: definition provided for explicit instantiation
    HashMap.cpp:102: non-template used as template
    HashMap.cpp:102: syntax error before `{'
    HashMap.cpp:110: ANSI C++ forbids declaration `runner' with no type
    HashMap.cpp:110: redefinition of `int runner'
    HashMap.cpp:94: `int runner' previously defined here
    HashMap.cpp:110: base operand of `->' is not a pointer
    HashMap.cpp:111: parse error before `}'
    HashMap.cpp:116: non-template type `HashMap' used as a template
    HashMap.cpp:117: can't initialize friend function `<<'
    HashMap.cpp:117: friend declaration not in class definition
    HashMap.cpp:117: ANSI C++ forbids declaration `hm' with no type
    HashMap.cpp:117: template parameter list used in explicit instantiation
    HashMap.cpp:117: definition provided for explicit instantiation
    HashMap.cpp:117: template-id `operator <<<>' for `operator <<(ostream &, const i
    nt &)' does not match any template declaration
    HashMap.cpp:117: syntax error before `{'
    HashMap.cpp:118: parse error before `;'
    HashMap.cpp:118: syntax error before `++'
    HashMap.cpp:125: non-member function `PrintBucket(KeyType)' cannot have `const'
    method qualifier
    HashMap.cpp:125: definition provided for explicit instantiation
    HashMap.cpp:125: non-template used as template
    HashMap.cpp:125: syntax error before `{'
    HashMap.cpp:127: syntax error before `*'
    HashMap.cpp:133: syntax error before `<'
    HashMap.cpp:141: ANSI C++ forbids declaration `runner' with no type
    HashMap.cpp:141: redefinition of `int runner'
    HashMap.cpp:110: `int runner' previously defined here
    HashMap.cpp:141: base operand of `->' is not a pointer
    HashMap.cpp:142: parse error before `}'
    HashMap.cpp:143: redefinition of `class string s1'
    HashMap.cpp:96: `class string s1' previously defined here
    HashMap.cpp:143: multiple initializations given for `s1'
    HashMap.cpp:144: parse error before `throw'
    proj5.cpp:29: syntax error before `int'
    proj5.cpp:32: parse error before `)'
    proj5.cpp:34: definition provided for explicit instantiation
    proj5.cpp:34: non-template used as template
    proj5.cpp:34: syntax error before `{'
    proj5.cpp:36: non-template type `HashMap' used as a template
    proj5.cpp:36: `hash' was not declared in this scope
    proj5.cpp:36: `nrBuckets' was not declared in this scope
    proj5.cpp:36: ANSI C++ forbids declaration `hmap' with no type
    proj5.cpp:36: initializer list being treated as compound expression
    proj5.cpp:39: syntax error before `<'
    proj5.cpp:40: syntax error before `<'
    proj5.cpp:43: syntax error before `.'
    proj5.cpp:44: syntax error before `.'
    proj5.cpp:45: syntax error before `.'
    proj5.cpp:46: syntax error before `.'
    proj5.cpp:47: syntax error before `.'
    proj5.cpp:48: syntax error before `.'
    proj5.cpp:49: syntax error before `.'
    proj5.cpp:50: syntax error before `.'
    proj5.cpp:51: syntax error before `.'
    proj5.cpp:54: syntax error before `<'
    proj5.cpp:55: syntax error before `<'
    proj5.cpp:58: syntax error before `.'
    proj5.cpp:61: ANSI C++ forbids declaration `success' with no type
    proj5.cpp:61: request for member `Replace' in `hmap', which is of non-aggregate
    type `int'
    proj5.cpp:64: ANSI C++ forbids declaration `success' with no type
    proj5.cpp:64: redefinition of `int success'
    proj5.cpp:61: `int success' previously defined here
    proj5.cpp:64: request for member `Replace' in `hmap', which is of non-aggregate
    type `int'
    proj5.cpp:67: request for member `Find' in `hmap', which is of non-aggregate typ
    e `int'
    proj5.cpp:70: ANSI C++ forbids declaration `success' with no type
    proj5.cpp:70: redefinition of `int success'
    proj5.cpp:64: `int success' previously defined here
    proj5.cpp:70: request for member `Has' in `hmap', which is of non-aggregate type
    `int'
    proj5.cpp:73: ANSI C++ forbids declaration `success' with no type
    proj5.cpp:73: redefinition of `int success'
    proj5.cpp:70: `int success' previously defined here
    proj5.cpp:73: request for member `Remove' in `hmap', which is of non-aggregate t
    ype `int'
    proj5.cpp:74: parse error before `return'
    proj5.cpp:79: definition provided for explicit instantiation
    proj5.cpp:79: non-template used as template
    proj5.cpp:79: syntax error before `{'
    HashMap.cpp:143: definition provided for explicit instantiation
    HashMap.cpp:143: non-template used as template
    HashMap.cpp:143: confused by earlier errors, bailing out
    make: *** [proj5.o] Error 1

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    43

    AAAH

    getting desporate people...any help at all...aaaaaaaaaaaanything!

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    43

    AAAH

    getting desporate people...any help at all...aaaaaaaaaaaanything!

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Hang on. Let me just brush the dust off my crystal ball then i'll be able to see your code. Until the smoke clears you will have to wait lol
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed