首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GCC 8.3.1中无法用TSDuck编译

GCC 8.3.1中无法用TSDuck编译
EN

Stack Overflow用户
提问于 2021-08-17 20:25:51
回答 1查看 97关注 0票数 0
  • TSDuck版本3.27.2438
  • GCC版本8.3.1
  • Centos 7.9

我正在尝试编译一些针对TSDuck的代码(RPM安装版本3.27-2438)。我在UString.h上得到一个编译错误。GCC似乎对在擦除功能中使用const_iterator表示不满。据我所知,这是自C++11以来允许的,应该在GCC 8.3.1中实施。还有其他人遇到过这个问题吗?这似乎是一个编译器错误,但我也在GCC 9.3.1中尝试过,并得到了同样的错误。

错误:

代码语言:javascript
复制
/usr/include/tsduck/tsUString.h:2088:84: error: no matching function for call to ‘ts::UString::erase(std::basic_string<char16_t>::const_iterator&)’
         iterator erase(const_iterator position) { return SuperClass::erase(position); }
                                                                                    ^
In file included from /opt/rh/devtoolset-8/root/usr/include/c++/8/string:52,
                 from /opt/rh/devtoolset-8/root/usr/include/c++/8/stdexcept:39,
                 from /opt/rh/devtoolset-8/root/usr/include/c++/8/array:39,
                 from /opt/rh/devtoolset-8/root/usr/include/c++/8/tuple:39,
                 from /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/unique_ptr.h:37,
                 from /opt/rh/devtoolset-8/root/usr/include/c++/8/memory:80,
                 from /workspaces/ts_reader/src/ts_reader/ts_reader.cpp:4:
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/basic_string.h:4632:7: note: candidate: ‘std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::erase(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
       erase(size_type __pos = 0, size_type __n = npos)
       ^~~~~
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/basic_string.h:4632:7: note:   no known conversion for argument 1 from ‘std::basic_string<char16_t>::const_iterator’ {aka ‘__gnu_cxx::__normal_iterator<const char16_t*, std::basic_string<char16_t> >’} to ‘std::basic_string<char16_t>::size_type’ {aka ‘long unsigned int’}
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/basic_string.h:4648:7: note: candidate: ‘std::basic_string<_CharT, _Traits, _Alloc>::iterator std::basic_string<_CharT, _Traits, _Alloc>::erase(std::basic_string<_CharT, _Traits, _Alloc>::iterator) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator<char16_t*, std::basic_string<char16_t> >; typename _Alloc::rebind<_CharT>::other::pointer = char16_t*]’
       erase(iterator __position)
       ^~~~~
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/basic_string.h:4648:7: note:   no known conversion for argument 1 from ‘__normal_iterator<const char16_t*,[...]>’ to ‘__normal_iterator<char16_t*,[...]>’
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/basic_string.h:4668:7: note: candidate: ‘std::basic_string<_CharT, _Traits, _Alloc>::iterator std::basic_string<_CharT, _Traits, _Alloc>::erase(std::basic_string<_CharT, _Traits, _Alloc>::iterator, std::basic_string<_CharT, _Traits, _Alloc>::iterator) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::iterator = __gnu_cxx::__normal_iterator<char16_t*, std::basic_string<char16_t> >; typename _Alloc::rebind<_CharT>::other::pointer = char16_t*]’
       erase(iterator __first, iterator __last);
       ^~~~~
EN

回答 1

Stack Overflow用户

发布于 2021-08-17 21:24:18

检查您是否正在使用C++11 ABI。

macros.html

_GLIBCXX_USE_CXX11_ABI 默认情况下定义为值1。可配置通过--禁用-libstdcxx-双-abi和/或-默认-libstdcxx-abi。ABI-变化。当定义为非零值时,库头将使用GCC 5中引入的新的C++11符合ABI的ABI,而不是GCC 3.4中引入的旧的ABI。这改变了几个类模板的定义,包括std:string、std::list和一些locale方面。有关更多细节,请参见双ABI

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68823622

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档