我尝试使用abseil的字符串库,但是这个简单的例子已经不能运行了,而且terminate called after throwing an instance of 'std::bad_alloc'也失败了。
我使用的代码片段
#include "absl/strings/str_cat.h"
#include "fmt/core.h"
int main(){
auto s1 = absl::StrCat("A string ", " another string", "yet another string");
fmt::print( "{}\n", s1);
}我使用Abseil 20200923.2和conan/cmake。我试过了gcc 10.1和clang 11,结果都一样。我怎样才能让这段代码运行?
发布于 2021-02-06 17:49:07
这在godbolt中工作得很好,无论是在gcc的领导下还是在clang下……
因此,我敢打赌这是一个库问题:您的主()代码、Abseil和fmt以及您的标准库并不都在完全相同的c++版本上。
https://stackoverflow.com/questions/65760273
复制相似问题