Reference to class is ambiguous??

I keep getting 2 errors in my cpp file for the first line:
Expected a class or namespace

Reference to 'hash' is ambiguous


Please help.....

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

//hash.h file
#ifndef __HashTable__hash__
#define __HashTable__hash__

#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;


class hash{

public:
    int Hash(string value);
    
};

#endif /* defined(__HashTable__hash__) */





//hash.cpp file
#include "hash.h"




int hash::Hash(string key)
{
    
}
I would suggest getting rid of line 10 and making appropriate changes elsewhere.
Wow thanks that worked. But why does it do that would you know?
using namespace std; takes the contents of that namespace and dumps it all into global scope. If you ever try to use a name that happened to be in there, it'll clash. That's why it's good practice to not use such a broad directive, especially in headers when people who use that code might not want the std namespace filling the global one.
awww makes sense. Thanks for the clarification.
Topic archived. No new replies allowed.