C++:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| class CSocket; #include <hash_map> using namespace std; struct eq { bool operator () ( SOCKET s1, SOCKET s2 ) const { return (s1 == s2); } }; hash_map<SOCKET, CSocket, hash<SOCKET>, eq> m_colSockets; |
Dat heb ik, maar die geeft deze fout:
code:
1
2
3
4
5
6
| c:\program files\common files\vc98\include\stl_pair.h(42) : error C2079: 'second' uses undefined class 'CSocket'
c:\program files\common files\vc98\include\stl_function.h(335) : see reference to class template instantiation 'std::pair<unsigned int const ,class CSocket>' being compiled
c:\program files\common files\vc98\include\stl_hashtable.h(231) : see reference to class template instantiation 'std::_Select1st<struct std::pair<unsigned int const ,class CSocket> >' being compiled
c:\program files\common files\vc98\include\stl_hash_map.h(69) : see reference to class template instantiation 'std::hashtable<struct std::pair<unsigned int const ,class CSocket>,unsigned int,struct std::hash<unsigned int>,struct std::_Select1st<struct std::pair<unsigned int const ,class CSocket> >,struct eq,class std::__default_alloc_template<1,0> >' being compiled
c:\c++ programs\maindll\csocket.h(27) : see reference to class template instantiation 'std::hash_map<unsigned int,class CSocket,struct std::hash<unsigned int>,struct eq,class std::__default_alloc_template<1,0> >' being compiled
CSocket.cpp |
Wat ik daaruit begrijp is dat ie class CSocket niet kent... Maar toch zet ik die helemaal vanboven (dus als ik het goed heb is dat zeggen van die class bestaat, maar ik zal deze later definiëren).
Enig idee + misschien wat uitleg hoe op te lossen & waarom hij deze fout geeft?