Ok, so this is the continuing saga of porting my code from VC6.0 to VC7.1...
so here's the story... i have some libraries that i have rebuilt with no problems under VC7.1... now i have another project that uses this library and when i come to build it, i get 2 linker errors:
>>>
ashlibd.lib(ImagedTarget.obj) : error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl ashlib:perator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class ashlib::Tuple2<float>)" (??6ashlib@@YAAAV?$basic_ostream@DU?$char_traits@D @std@@@std@@AAV12@V?$Tuple2@M@0@@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl ashlib:perator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class ashlib::ImagedTarget const &)" (??6ashlib@@YAAAV?$basic_ostream@DU?$char_traits@D @std@@@std@@AAV12@ABVImagedTarget@0@@Z)
ashlibd.lib(Target.obj) : error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl ashlib:perator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class ashlib::Tuple3<float>)" (??6ashlib@@YAAAV?$basic_ostream@DU?$char_traits@D @std@@@std@@AAV12@V?$Tuple3@M@0@@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl ashlib:perator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class ashlib::Target const &)" (??6ashlib@@YAAAV?$basic_ostream@DU?$char_traits@D @std@@@std@@AAV12@ABVTarget@0@@Z)
>>>
now, i have tried everything i can think of, and i really can't figure it out, but the linker errors are refering to the overloaded operator '<<' in my Tuple2 and Tuple3 classes:
so, there is this issue of the method not being a member function, due to the 'friend'... so maybe thats the issue... but i can't figure out how else to do it.... the annoying thing is that this all works fine under VC6.0 ...... ARRGGGGHHH!!!!!! please help.Code:#ifndef TUPLE2_H #define TUPLE2_H #include <cmath> #include <fstream> #include <iostream> namespace ashlib { template<class T> class Tuple2 { public: T x; T y; public: Tuple2() { x=y=0; } ... friend std::ostream& operator<<(std::ostream& os, Tuple2<T> v); }; ... template<class T> std::ostream& operator<<(std::ostream& os, Tuple2<T> v) { return os << "[" << v.x << "," << v.y << "]"; } }//end namespace #endif