红联Linux门户
Linux帮助

error: cannot pass objects of non-trivially-copyable type

发布时间:2016-04-01 15:09:16来源:linux网站作者:Acoolbest

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()

编译即可通过。


本文永久更新地址:http://www.linuxdiyf.com/linux/19436.html