我试图编译Microsoft示例“Overloading the << Operator for Your Own Classes”,但得到以下链接错误:微软重载<<操作样品抛出链接错误
error LNK1169: one or more multiply defined symbols found
error LNK2005: "class std::basic_ostream > & __cdecl operator<<(class std::basic_ostream > &,class Date const &)" ([email protected][email protected][email protected]@[email protected]@@[email protected]@[email protected]@@@Z) already defined in Date.obj
任何人这是为什么不编译任何想法?
你有链接到源代码? – 2012-01-29 13:30:53
你能发布导致此问题的代码吗? – hmjd 2012-01-29 13:31:13
没有什么可能会产生此错误消息。示例在这里:http://msdn.microsoft.com/en-us/library/1z2f6c2k.aspx。它编译并运行。 – SChepurin 2012-01-29 13:37:11