error C2143: 語法錯誤 : 缺少“;”(在“&”的前面)


報錯:

  error C2143: 語法錯誤 : 缺少“;”(在“&”的前面)

代碼:

#include <iostream>

ostream & << (ostream& os, int i)

{

  return os << i ;

}

 

解決方法:加入using namespace std;

解決報錯后代碼:

#include <iostream>

using namespace std;

ostream & << (ostream& os, int i)

{

  return os << i ;

}

Or

#include <iostream>

std::ostream & << (std::ostream& os, int i)
{
  return os << i ;
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM