[Error] cannot pass objects of non-trivially-copyable type 'std::string {aka class std::basic_string<char>}' through '...'
1. 报错
[Error] cannot pass objects of non-trivially-copyable type 'std::string {aka class std::basic_string<char>}' through '...'
2. 原因
不应该使用printf
输出一个String
类型的字符串
3.解决办法
使用cout << str
4.注
同样的问题有:
- 使用
scanf
【c语言】输入string
【c++】的对象。这个也会引起程序的崩溃