O
Ook
This is my code in it's entireity:
#include <iostream>
using namespace std;
template <typename T>
class SortedList
{
public:
friend ostream& operator<< (ostream& os, const SortedList<T>& lst );
};
template <typename T>
ostream& operator<< (ostream& os, const SortedList<T>& lst)
{
return os;
}
int main()
{
SortedList<int> sList;
//This compiles fine until I add cout << sList; in main():
cout << sList;
return 0;
}
If I comment out cout <, sList;, it compiles fine. When I add cout << sList,
I get compile error.
unresolved external symbol "class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl operator<<(class
std::basic_ostream<char,struct std::char_traits<char> > &,class
SortedList<int> const &)"
(??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABV?$SortedList@H@@@Z)
referenced in function _main
I know this is a specific compiler error and this is not a specific compiler
newsgroup, but I'm hoping someone can tell from the above what I'm doing
wrong.
#include <iostream>
using namespace std;
template <typename T>
class SortedList
{
public:
friend ostream& operator<< (ostream& os, const SortedList<T>& lst );
};
template <typename T>
ostream& operator<< (ostream& os, const SortedList<T>& lst)
{
return os;
}
int main()
{
SortedList<int> sList;
//This compiles fine until I add cout << sList; in main():
cout << sList;
return 0;
}
If I comment out cout <, sList;, it compiles fine. When I add cout << sList,
I get compile error.
unresolved external symbol "class std::basic_ostream<char,struct
std::char_traits<char> > & __cdecl operator<<(class
std::basic_ostream<char,struct std::char_traits<char> > &,class
SortedList<int> const &)"
(??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABV?$SortedList@H@@@Z)
referenced in function _main
I know this is a specific compiler error and this is not a specific compiler
newsgroup, but I'm hoping someone can tell from the above what I'm doing
wrong.