Reagarding error with ostream
-
Hi.. I have implemented ECC algorithm in C++ and it is working fine with g++ compiler... I need to apply this program to network simulator - 3. Complier of NS-3 is "./waf", there it is not building and it is giving countless errors mainly regarding "ostream". there is a line regarding ostream in my header function....---
// ostream handler
template<int T>
friend ostream& operator<<(ostream& os, const FiniteFieldElement<T>& g)
{
return os << g.i_;
} -
Hi.. I have implemented ECC algorithm in C++ and it is working fine with g++ compiler... I need to apply this program to network simulator - 3. Complier of NS-3 is "./waf", there it is not building and it is giving countless errors mainly regarding "ostream". there is a line regarding ostream in my header function....---
// ostream handler
template<int T>
friend ostream& operator<<(ostream& os, const FiniteFieldElement<T>& g)
{
return os << g.i_;
} -
Manoj7390 wrote:
it is giving countless errors
Without the detail of those errors no one can guess what is wrong.
Use the best guess
In the main program i am calling another header function called "FiniteFieldElement.h" function. In that function i have used --
// ostream handler
template<int T>
friend ostream& operator<<(ostream& os, const FiniteFieldElement<T>& g)
{
return os << g.i_;
}I am calling this function and using "ostream" in so many places in main function. I am getting the errors like.. /usr/include/c++/4.6/ostream:493:5: note: template std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const _CharT*) /usr/include/c++/4.6/ostream:473:5: note: template std::basic_ostream& std::operator<<(std::basic_ostream&, unsigned char) /usr/include/c++/4.6/ostream:468:5: note: template std::basic_ostream& std::operator<<(std::basic_ostream&, signed char) /usr/include/c++/4.6/ostream:462:5: note: template std::basic_ostream& std::operator<<(std::basic_ostream&, char) /usr/include/c++/4.6/ostream:456:5: note: template std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, char) /usr/include/c++/4.6/ostream:451:5: note: template std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, _CharT)
-
In the main program i am calling another header function called "FiniteFieldElement.h" function. In that function i have used --
// ostream handler
template<int T>
friend ostream& operator<<(ostream& os, const FiniteFieldElement<T>& g)
{
return os << g.i_;
}I am calling this function and using "ostream" in so many places in main function. I am getting the errors like.. /usr/include/c++/4.6/ostream:493:5: note: template std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const _CharT*) /usr/include/c++/4.6/ostream:473:5: note: template std::basic_ostream& std::operator<<(std::basic_ostream&, unsigned char) /usr/include/c++/4.6/ostream:468:5: note: template std::basic_ostream& std::operator<<(std::basic_ostream&, signed char) /usr/include/c++/4.6/ostream:462:5: note: template std::basic_ostream& std::operator<<(std::basic_ostream&, char) /usr/include/c++/4.6/ostream:456:5: note: template std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, char) /usr/include/c++/4.6/ostream:451:5: note: template std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, _CharT)
-
I'm not sure that
template
is correct for overloading the
<<
operator. See http://msdn.microsoft.com/en-us/library/1z2f6c2k.aspx[^].Use the best guess
I think it is not the problem with the code, because i am getting the output with g++ compiler. Now i am using ./waf compiler for NS-3, where i am facing problem. I am not sure ostream is supported by NS-3 because there they use NS_LOG_UNCOND("message") instead of "cout". I am getting errors where i have used ostream. What do you mean by "ostream" and is it compiler dependent.
-
I think it is not the problem with the code, because i am getting the output with g++ compiler. Now i am using ./waf compiler for NS-3, where i am facing problem. I am not sure ostream is supported by NS-3 because there they use NS_LOG_UNCOND("message") instead of "cout". I am getting errors where i have used ostream. What do you mean by "ostream" and is it compiler dependent.
-
Manoj7390 wrote:
What do you mean by "ostream"
I don't mean anything by it, it is part of the standard C++ library. Also, I have no idea what ./waf compiler for NS-3 is, or what features it supports.
Use the best guess
-