求助:无法解析的外部符号 “class std::basic_ostream...”

palm505 palm505 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
源代码中有
template <class T>
ostream & operator<< (ostream & output, const Array<T> & theArray)
{
for(int i=0; i<theArray.GetSize(); i++)
output << "[" << i << "]" << theArray[i] << endl;
return output;
}

编译链接时出现如下错误
001.obj : error LNK2019: 无法解析的外部符号 "class std::basic_ostream > & __cdecl operator<<(class std::basic_ostream > &,class Array const &)" (??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABV?$Array@VAnimal@@@@@Z) ,该符号在函数 _main 中被引用。

请指点
...全文

相关推荐

VC6.0中重载操作符友元函数无法访问类的私有成员的解决办法.docx

。

G11176593

VC6.0中重载操作符友元函数无法访问类的私有成员的解决办法.pdf

。

G11176593

String类的写时拷贝实例

实例如下: #include<iostream> using namespace std; class String; ostream& operator&lt;&lt;(ostream &out, const String&s); //引用计数器类 class String_rep { friend class String; friend ostream& operator&lt;&lt;(ostream &out, const String&s); public: String_rep(const char *str ) :use_count(0) { if (

weixin_38633897

C++中的模拟class string类的代码 cpp

//一个C++初学者的string类,恳请朋友们多多指点 //特殊功能:- 取负数运算符代表将字符串翻转 函数头: class string{ friend int len(string &); friend const string & operator+(const string &s1,const string &s2); friend std::ostream & operator<<(std::ostream &theStream,const string & str); friend const string & operator+(const string &s1,const char * s2); friend const string & operator+(const char * s2,const string &s1); private: int itslen; public: string(); string(int length); string(string & str); string(const char *str); const string & operator=(const char str[]); const string & operator+=(const char str[]); const string & operator-()const; const char & operator[](int index) const; operator char*() const; char & operator[](const int index); ~string(); void put(); char *inner; operator int()const; };

sunices92

C++程序设计教学课件:12 THE C++ INPUT OUTPUT CLASS HIERARCHY.ppt

C++程序设计教学课件:CHAPTER 12 THE C++ INPUT OUTPUT CLASS HIERARCHY.ppt

wxg520cxl
评论 5
收藏 已收藏
分享
返回顶部
palm505
VC/MFC 16,550 成员 421,606 内容