So, I'm making a Hash Table dividing the classes between different archives. Than, the problem is, even if I include the "hash.hpp" file into the main, it looks like it does not recingisse it.
The erros are:
main.cpp:7:5: error: reference to 'hash' is ambiguous
hash teste;
^
./hash.hpp:10:7: note: candidate found by name lookup is 'hash'
class hash{
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
#include "hash.hpp"
usingnamespace std;
int main (){
hash test;
test.insert(17);
cout << test.search(17)<< endl;
return 0;
}
On line 8 the compiler doesn't know if you want your hash class or std::hash. This is one of the drawbacks of using namespace std;
Removing it would fixes the issue. Other possible solutions are to rename your hash class, or to write ::hash to let the compiler know that you want the hash defined in the global namespace.