Thank you very much for your help. You are right about the MeshTest::Report() is not able to handle the std::cout. I had to comment out most of the function body to avoid errors when compile.
I changed the code according to your suggestion but it seems that the compiler invokes the wrong template: Schedule(const ns3::Time&, MEM, OBJ, T1) instead of Schedule(const ns3::Time&, void(*)(U1), OBJ, T1) or something similar to this. On top of that, the copy constructor is called when passing std::cout as the 4th argument. and the following error message popped up. Could you help take a look into the problem? I have attached my version of the mesh.cc for your reference.
In file included from /usr/include/c++/4.8/ios:42:0,
from /usr/include/c++/4.8/ostream:38,
from /usr/include/c++/4.8/iostream:39,
from ./ns3/fatal-error.h:24,
from ./ns3/abort.h:24,
from ./ns3/core-module.h:10,
from ../src/mesh/examples/mesh.cc:47:
/usr/include/c++/4.8/bits/ios_base.h: In copy constructor ‘std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)’:
/usr/include/c++/4.8/bits/ios_base.h:792:5: error: ‘std::ios_base::ios_base(const std::ios_base&)’ is private
ios_base(const ios_base&);
^
In file included from /usr/include/c++/4.8/ios:44:0,
from /usr/include/c++/4.8/ostream:38,
from /usr/include/c++/4.8/iostream:39,
from ./ns3/fatal-error.h:24,
from ./ns3/abort.h:24,
from ./ns3/core-module.h:10,
from ../src/mesh/examples/mesh.cc:47:
/usr/include/c++/4.8/bits/basic_ios.h:66:11: error: within this context
class basic_ios : public ios_base
^
In file included from /usr/include/c++/4.8/iostream:39:0,
from ./ns3/fatal-error.h:24,
from ./ns3/abort.h:24,
from ./ns3/core-module.h:10,
from ../src/mesh/examples/mesh.cc:47:
/usr/include/c++/4.8/ostream: In copy constructor ‘std::basic_ostream<char>::basic_ostream(const std::basic_ostream<char>&)’:
/usr/include/c++/4.8/ostream:58:11: note: synthesized method ‘std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)’ first required here
class basic_ostream : virtual public basic_ios<_CharT, _Traits>
^