I'm attempting to compile the ZipStream library, it is effectivley a C++ wrapper for zlib.
我正在尝试编译ZipStream库,它实际上是zlib的c++包装器。
Right now I'm at the point where I'm getting two compile errors on these two lines:
现在我在这两行有两个编译错误:
std::set<file_info_32*, sort_by_offset>::iterator first = _core->_entries_by_name.begin();
std::set<file_info_32*, sort_by_offset>::iterator last = _core->_entries_by_name.end();
The errors are:
错误:
Error 15 error C2440:
'initializing'
: cannot convert from'std::_Tree_const_iterator<_Mytree>'
to'std::_Tree_const_iterator<_Mytree>'
c:\users\ahakeem\desktop\zipstream\ziparchive.cpp 423 1 zipstream
Error 16 error C2440:'initializing'
: cannot convert from'std::_Tree_const_iterator<_Mytree>'
to'std::_Tree_const_iterator<_Mytree>'
c:\users\ahakeem\desktop\zipstream\ziparchive.cpp 424 1 zipstream错误15:“初始化”:无法从“std::_Tree_const_iterator<_Mytree>”转换为“std::_Tree_const_iterator<_Mytree>' c:\用户\ahakeem desktop zipstream\ziparchive。cpp 423 1 zipstream Error 16 Error C2440: 'initializing': can ' t convert from 'std::_Tree_const_iterator<_Mytree>' to 'std::_Tree_const_iterator<_Mytree>' c:\用户\ahakeem desktop zipstream\ziparchive。cpp 424 1 zipstream
So basically the compiler says it can't convert from 'std::_Tree_const_iterator<_Mytree>'
to 'std::_Tree_const_iterator<_Mytree>'
基本上编译器会说它不能从" std::_Tree_const_iterator<_Mytree> "转换为" std::_Tree_const_iterator<_Mytree> "
Any ideas why it's happening and how to fix?
有什么想法吗?
edit: after further investigating I've found that _core->entries_by_name.begin()
is declared as 'std::set<file_info_32*, sort_by_offset>'
, which is obviously inconsistant with what its iterator is trying to be assigned to (std::set<file_info_32*, sort_by_offset>
).
编辑:在进一步调查之后,我发现_core->entries_by_name.begin()被声明为“std::set
Switching it to _core->_entries_by_offset.begin();
works because _entries_by_offset
is a type consistant with what the assignee is expecting to get.
切换到_core - > _entries_by_offset.begin();之所以有效,是因为_entries_by_offset是与受让人期望得到的值相一致的类型。
Does this mean someone may have broken the code, didn't realize it and uploaded it to the source repo? Or can this scenario of erraneous assignment actually compile on some systems?
这是否意味着有人可能破坏了代码,没有意识到它并将其上传到源repo?或者,这种无关分配的场景真的可以在某些系统上编译吗?
1 个解决方案
#1
4
My best guess, the classes substituted for _MyTree
are different.
我猜,用_MyTree替换的类是不同的。
Look for with _MyTree = SomeClass
somewhere in your output just below the error.
在您的输出中,在错误的下方找到_MyTree = SomeClass。
#1
4
My best guess, the classes substituted for _MyTree
are different.
我猜,用_MyTree替换的类是不同的。
Look for with _MyTree = SomeClass
somewhere in your output just below the error.
在您的输出中,在错误的下方找到_MyTree = SomeClass。