c++ - error: no match for ‘operator=’ -
i trying compile source in repository:
https://github.com/maartenbaert/ssr
and compilation errors on particular source file:
https://github.com/maartenbaert/ssr/blob/master/src/gui/pageoutput.cpp
with following error:
../../src/gui/pageoutput.cpp:66: error: no match ‘operator=’ in ‘((pageoutput*)this)->pageoutput::m_containers = {{"matroska (mkv)", "matroska", {"mkv"}, "matroska files (*.mkv)", {(pageoutput::enum_video_codec)0u, (pageoutput::enum_video_codec)1u, (pageoutput::enum_video_codec)2u}, {(pageoutput::enum_audio_codec)0u, (pageoutput::enum_audio_codec)1u, (pageoutput::enum_audio_codec)2u, (pageoutput::enum_audio_codec)3u}}, {"mp4", "mp4", {"mp4"}, "mp4 files (*.mp4)", {(pageoutput::enum_video_codec)0u}, {(pageoutput::enum_audio_codec)0u, (pageoutput::enum_audio_codec)1u, (pageoutput::enum_audio_codec)2u}}, {"webm", "webm", {"webm"}, "webm files (*.webm)", {(pageoutput::enum_video_codec)1u}, {(pageoutput::enum_audio_codec)0u}}, {"ogg", "ogg", {"ogg"}, "ogg files (*.ogg)", {(pageoutput::enum_video_codec)2u}, {(pageoutput::enum_audio_codec)0u}}, {"other...", "", <brace-enclosed initializer list>(), "", <brace-enclosed initializer list>(), <brace-enclosed initializer list>()}}’ /usr/lib/gcc/x86_64-redhat-linux6e/4.4.6/../../../../include/c++/4.4.6/bits/vector.tcc:156: note: candidates are: std::vector<_tp, _alloc>& std::vector<_tp, _alloc>::operator=(const std::vector<_tp, _alloc>&) [with _tp = pageoutput::containerdata, _alloc = std::allocator<pageoutput::containerdata>] /usr/lib/gcc/x86_64-redhat-linux6e/4.4.6/../../../../include/c++/4.4.6/bits/stl_vector.h:336: note: std::vector<_tp, _alloc>& std::vector<_tp, _alloc>::operator=(std::vector<_tp, _alloc>&&) [with _tp = pageoutput::containerdata, _alloc = std::allocator<pageoutput::containerdata>] /usr/lib/gcc/x86_64-redhat-linux6e/4.4.6/../../../../include/c++/4.4.6/bits/stl_vector.h:356: note: std::vector<_tp, _alloc>& std::vector<_tp, _alloc>::operator=(std::initializer_list<_tp>) [with _tp = pageoutput::containerdata, _alloc = std::allocator<pageoutput::containerdata>] make[2]: *** [simplescreenrecorder-pageoutput.o] error 1
the offending code, formatted:
m_containers = { {"matroska (mkv)", "matroska", {"mkv"}, "matroska files (*.mkv)", {video_codec_h264, video_codec_vp8, video_codec_theora}, {audio_codec_vorbis, audio_codec_mp3, audio_codec_aac, audio_codec_uncompressed}}, {"mp4", "mp4", {"mp4"}, "mp4 files (*.mp4)" , {video_codec_h264}, {audio_codec_vorbis, audio_codec_mp3, audio_codec_aac}}, {"webm", "webm", {"webm"}, "webm files (*.webm)" , {video_codec_vp8}, {audio_codec_vorbis,}}, {"ogg", "ogg", {"ogg"}, "ogg files (*.ogg)" , {video_codec_theora}, {audio_codec_vorbis}}, {"other...", "", {}, "", {}, {}}, };
i'm more of c programmer , c++ bit rusty. have searched around , error common have yet been unable figure out problem one.
gcc 4.4.6 doesn't support having std::initializer_list
parameter, list assignment isn't possible. however, it's easy work around if upgrading gcc not possible:
pageoutput::containerdata temp[] = { {"matroska (mkv)", "matroska", {"mkv"}, "matroska files (*.mkv)", {video_codec_h264, video_codec_vp8, video_codec_theora}, {audio_codec_vorbis, audio_codec_mp3, audio_codec_aac, audio_codec_uncompressed}}, {"mp4", "mp4", {"mp4"}, "mp4 files (*.mp4)" , {video_codec_h264}, {audio_codec_vorbis, audio_codec_mp3, audio_codec_aac}}, {"webm", "webm", {"webm"}, "webm files (*.webm)" , {video_codec_vp8}, {audio_codec_vorbis,}}, {"ogg", "ogg", {"ogg"}, "ogg files (*.ogg)" , {video_codec_theora}, {audio_codec_vorbis}}, {"other...", "", {}, "", {}, {}}, }; m_containers.assign(std::begin(temp), std::end(temp));
i can't remember if std::begin/end
exist in version, they're trivial implement otherwise:
template<typename t, std::size_t n> t *begin(const t(&arr)[n]) {return arr;} template<typename t, std::size_t n> t *end(const t(&arr)[n]) {return arr + n;}
Comments
Post a Comment