日期:2021/12/1
报错
之前编译运行Fast_RNRR时完全没有问题,命令如下:
cmake -DCMAKE_BUILD_TYPE=Release ..
make
可是今天再按照上面的方式编译运行的时候,出现大面积的报错,比如:
/usr/include/c++/5/bits/unordered_map.h: In member function ‘void std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator, _InputIterator)’:
/usr/include/c++/5/bits/unordered_map.h:489:9: error: request for member ‘insert’ in ‘((std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>*)this)->std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::_M_h’, which is of non-class type ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::_Hashtable {aka int}’
{ _M_h.insert(__first, __last); }
^
/usr/include/c++/5/bits/unordered_map.h: In member function ‘void std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(std::initializer_list<int>)’:
/usr/include/c++/5/bits/unordered_map.h:500:14: error: request for member ‘insert’ in ‘((std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>*)this)->std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::_M_h’, which is of non-class type ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::_Hashtable {aka int}’
{ _M_h.insert(__l); }
又比如:
In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
from /usr/include/c++/5/vector:60,
from /home/sun/Fast_RNRR/include/nanoflann.hpp:49,
from /home/sun/Fast_RNRR/src/tools/nanoflann.h:2,
from /home/sun/Fast_RNRR/src/Registration.h:3,
from /home/sun/Fast_RNRR/src/NonRigidreg.h:3,
from /home/sun/Fast_RNRR/src/NonRigidreg.cpp:2:
/usr/include/c++/5/bits/stl_pair.h: In instantiation of ‘struct std::pair<int, int>’:
/usr/include/c++/5/bits/unordered_map.h:646:7: required from here
/usr/include/c++/5/bits/stl_pair.h:168:16: error: ‘std::pair<_T1, _T2>::is_nothrow_move_assignable’ has incomplete type
is_nothrow_move_assignable<_T2>>::value)
^
/usr/include/c++/5/bits/stl_pair.h:96:12: note: definition of ‘struct std::pair<int, int>’ is not complete until the closing brace
struct pair
还比如:
/usr/include/c++/5/bits/unordered_map.h:865:24: error: ‘_Hashtable’ is not a class, namespace, or enumeration
typedef typename _Hashtable::allocator_type allocator_type;
^
/usr/include/c++/5/bits/unordered_map.h:870:24: error: ‘_Hashtable’ is not a class, namespace, or enumeration
typedef typename _Hashtable::pointer pointer;
^
/usr/include/c++/5/bits/unordered_map.h:871:24: error: ‘_Hashtable’ is not a class, namespace, or enumeration
typedef typename _Hashtable::const_pointer const_pointer;
^
/usr/include/c++/5/bits/unordered_map.h:872:24: error: ‘_Hashtable’ is not a class, namespace, or enumeration
typedef typename _Hashtable::reference reference;
^
/usr/include/c++/5/bits/unordered_map.h:873:24: error: ‘_Hashtable’ is not a class, namespace, or enumeration
typedef typename _Hashtable::const_reference const_reference;
^
/usr/include/c++/5/bits/unordered_map.h:874:24: error: ‘_Hashtable’ is not a class, namespace, or enumeration
typedef typename _Hashtable::iterator iterator;
^
/usr/include/c++/5/bits/unordered_map.h:875:24: error: ‘_Hashtable’ is not a class, namespace, or enumeration
typedef typename _Hashtable::const_iterator const_iterator;
总之,错误非常多,看起来令人瑟瑟发抖。
However,
解决方法
只需要采用如下语句编译运行即可:
cmake -DCMAKE_BUILD_TYPE=Release ..
sudo make -j8
啊哈哈哈,本来以为又要在这个问题上耗费好几天的时间,没想到这么快就解决了,果然,只有我想不到,没有大佬做不到,我又行了!