I am getting the following error, when compiling my code.
"Main.cpp", line 129: Error: The operation "log4cpp::CategoryStream << std::basic_string<char, std::char_traits<char>, std::allocator<char>>" is illegal.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
std::sting abc = "abc";
CategoryStream & logger = Category::getInstance("Main");
logger.infoStream << abc;
I am getting the following error, when compiling my code.
"Main.cpp", line 129: Error: The operation "log4cpp::CategoryStream << std::basic_string<char, std::char_traits<char>, std::allocator<char>>" is illegal.
You can try:
logger.inforStream <<abc.c_str();
which should fix the problem you are having, since it converts the string object into a character array.
You told neither the version of log4cpp you are using nor your platform and compiler.
What you are trying to do should work since CategoryStream has an operator<< taking a const std::string& as argument.
PS :
I guess you meant :
Category& logger = Category::getInstance("Main");
logger.infoStream() << abc;