Ubuntu下C++编译出错如下:
error: cannot pass objects of non-trivially-copyable type ‘std::string {aka class std::basic_string<char>}’ through ‘...’
CPublicFunction::WriteLog("%s", ex.displayText());
改动如下:
CPublicFunction::WriteLog("%s", ex.displayText().c_str());
即在要打印的string后面加 .c_str()
编译即可通过。