http://www.cnblogs.com/bluestorm/archive/2012/09/01/2667141.html
http://www.zhihu.com/question/26201557
下载配置了 TDM-GCC、http://nuwen.net/mingw.html,运行http://www.hankcs.com/program/cpp/jetbrains-clion.html中的示例代码都没问题,但是使用vector的时候,如下代码:
#include <iostream> #include <bits/stl_bvector.h> using namespace std; int main() { std::vector<int> vector1 {2,3,4}; return 0; }
就一直报错:
Scanning dependencies of target untitled
[ 50%] Building CXX object CMakeFiles/untitled.dir/main.cpp.obj
In file included from d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_bvector.h:492:0,
from D:\Program Files (x86)\JetBrains\CLion 1.2.1\ClionProjects\untitled\main.cpp:2:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:74:35: error: ‘__alloc_traits‘ in namespace ‘__gnu_cxx‘ does not name a type
typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:74:49: error: expected unqualified-id before ‘<‘ token
typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:76:35: error: ‘__alloc_traits‘ in namespace ‘__gnu_cxx‘ does not name a type
typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:76:49: error: expected unqualified-id before ‘<‘ token
typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:81:7: error: expected class-name before ‘{‘ token
{
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:82:2: error: ‘pointer‘ does not name a type
pointer _M_start;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:83:2: error: ‘pointer‘ does not name a type
pointer _M_finish;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:84:2: error: ‘pointer‘ does not name a type
pointer _M_end_of_storage;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:90:30: error: expected ‘)‘ before ‘const‘
_Vector_impl(_Tp_alloc_type const& __a)
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:95:29: error: expected ‘)‘ before ‘&&‘ token
_Vector_impl(_Tp_alloc_type&& __a)
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:112:7: error: ‘_Tp_alloc_type‘ does not name a type
_Tp_alloc_type&
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:116:13: error: ‘_Tp_alloc_type‘ does not name a type
const _Tp_alloc_type&
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:139:34: error: expected ‘)‘ before ‘&&‘ token
_Vector_base(_Tp_alloc_type&& __a)
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:166:7: error: ‘pointer‘ does not name a type
pointer
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:171:21: error: ‘pointer‘ has not been declared
_M_deallocate(pointer __p, size_t __n)
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In constructor ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl()‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:87:4: error: class ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl‘ does not have any field named ‘_Tp_alloc_type‘
: _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:87:22: error: class ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl‘ does not have any field named ‘_M_start‘
: _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:87:35: error: class ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl‘ does not have any field named ‘_M_finish‘
: _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:87:49: error: class ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl‘ does not have any field named ‘_M_end_of_storage‘
: _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘void std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_M_swap_data(std::_Vector_base<_Tp, _Alloc>::_Vector_impl&)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:103:14: error: ‘_M_start‘ was not declared in this scope
std::swap(_M_start, __x._M_start);
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:104:14: error: ‘_M_finish‘ was not declared in this scope
std::swap(_M_finish, __x._M_finish);
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:105:14: error: ‘_M_end_of_storage‘ was not declared in this scope
std::swap(_M_end_of_storage, __x._M_end_of_storage);
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘std::_Vector_base<_Tp, _Alloc>::allocator_type std::_Vector_base<_Tp, _Alloc>::get_allocator() const‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:122:51: error: there are no arguments to ‘_M_get_Tp_allocator‘ that depend on a template parameter, so a declaration of ‘_M_get_Tp_allocator‘ must be available [-fpermissive]
{ return allocator_type(_M_get_Tp_allocator()); }
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:122:51: note: (if you use ‘-fpermissive‘, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: At global scope:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:219:15: error: ‘__alloc_traits‘ in namespace ‘__gnu_cxx‘ does not name a type
typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:224:24: error: ‘_Alloc_traits‘ has not been declared
typedef typename _Alloc_traits::const_pointer const_pointer;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:225:24: error: ‘_Alloc_traits‘ has not been declared
typedef typename _Alloc_traits::reference reference;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:226:24: error: ‘_Alloc_traits‘ has not been declared
typedef typename _Alloc_traits::const_reference const_reference;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:439:40: error: ‘_Alloc_traits‘ has not been declared
operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1110:13: error: ‘_Alloc_traits‘ has not been declared
noexcept(_Alloc_traits::_S_nothrow_swap())
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In copy constructor ‘std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:312:9: error: ‘_Alloc_traits‘ has not been declared
_Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator()))
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:314:4: error: ‘__uninitialized_copy_a‘ is not a member of ‘std‘
std::__uninitialized_copy_a(__x.begin(), __x.end(),
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In constructor ‘std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, const allocator_type&)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:334:4: error: ‘__uninitialized_copy_a‘ is not a member of ‘std‘
std::__uninitialized_copy_a(__x.begin(), __x.end(),
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In constructor ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:346:8: error: ‘__uninitialized_move_a‘ is not a member of ‘std‘
std::__uninitialized_move_a(__rv.begin(), __rv.end(),
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In destructor ‘std::vector<_Tp, _Alloc>::~vector()‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:415:9: error: ‘_Destroy‘ is not a member of ‘std‘
{ std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:442:11: error: ‘_Alloc_traits‘ has not been declared
_Alloc_traits::_S_propagate_on_move_assign()
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:443:14: error: ‘_Alloc_traits‘ has not been declared
|| _Alloc_traits::_S_always_equal();
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:445:48: error: the value of ‘__move_storage‘ is not usable in a constant expression
integral_constant<bool, __move_storage>());
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:445:62: error: the value of ‘__move_storage‘ is not usable in a constant expression
integral_constant<bool, __move_storage>());
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::max_size() const‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:651:16: error: ‘_Alloc_traits‘ has not been declared
{ return _Alloc_traits::max_size(_M_get_Tp_allocator()); }
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘void std::vector<_Tp, _Alloc>::push_back(const value_type&)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:905:6: error: ‘_Alloc_traits‘ has not been declared
_Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘void std::vector<_Tp, _Alloc>::pop_back()‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:940:2: error: ‘_Alloc_traits‘ has not been declared
_Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish);
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘void std::vector<_Tp, _Alloc>::swap(std::vector<_Tp, _Alloc>&)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1114:2: error: ‘_Alloc_traits‘ has not been declared
_Alloc_traits::_S_on_swap(_M_get_Tp_allocator(),
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘std::vector<_Tp, _Alloc>::pointer std::vector<_Tp, _Alloc>::_M_allocate_and_copy(std::vector<_Tp, _Alloc>::size_type, _ForwardIterator, _ForwardIterator)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1141:8: error: ‘__uninitialized_copy_a‘ is not a member of ‘std‘
std::__uninitialized_copy_a(__first, __last, __result,
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘void std::vector<_Tp, _Alloc>::_M_range_initialize(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1204:6: error: ‘__uninitialized_copy_a‘ is not a member of ‘std‘
std::__uninitialized_copy_a(__first, __last,
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘void std::vector<_Tp, _Alloc>::_M_fill_initialize(std::vector<_Tp, _Alloc>::size_type, const value_type&)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1214:2: error: ‘__uninitialized_fill_n_a‘ is not a member of ‘std‘
std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value,
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘void std::vector<_Tp, _Alloc>::_M_default_initialize(std::vector<_Tp, _Alloc>::size_type)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1224:2: error: ‘__uninitialized_default_n_a‘ is not a member of ‘std‘
std::__uninitialized_default_n_a(this->_M_impl._M_start, __n,
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘void std::vector<_Tp, _Alloc>::_M_erase_at_end(std::vector<_Tp, _Alloc>::pointer)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1352:2: error: ‘_Destroy‘ is not a member of ‘std‘
std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator());
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In member function ‘void std::vector<_Tp, _Alloc>::_M_move_assign(std::vector<_Tp, _Alloc>&&, std::true_type)‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1366:6: error: ‘_Alloc_traits‘ has not been declared
if (_Alloc_traits::_S_propagate_on_move_assign())
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1367:4: error: ‘__alloc_on_move‘ is not a member of ‘std‘
std::__alloc_on_move(_M_get_Tp_allocator(),
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In instantiation of ‘class std::vector<int>‘:
D:\Program Files (x86)\JetBrains\CLion 1.2.1\ClionProjects\untitled\main.cpp:9:22: required from here
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:218:48: error: no type named ‘_Tp_alloc_type‘ in ‘struct std::_Vector_base<int, std::allocator<int> >‘
typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:223:58: error: no type named ‘pointer‘ in ‘struct std::_Vector_base<int, std::allocator<int> >‘
typedef typename _Base::pointer pointer;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:227:61: error: no type named ‘pointer‘ in ‘struct std::_Vector_base<int, std::allocator<int> >‘
typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:231:49: error: no type named ‘pointer‘ in ‘struct std::_Vector_base<int, std::allocator<int> >‘
typedef std::reverse_iterator<iterator> reverse_iterator;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:237:20: error: no members matching ‘std::vector<int>::_Base {aka std::_Vector_base<int, std::allocator<int> >}::_M_allocate‘ in ‘std::vector<int>::_Base {aka struct std::_Vector_base<int, std::allocator<int> >}‘
using _Base::_M_allocate;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:240:20: error: no members matching ‘std::vector<int>::_Base {aka std::_Vector_base<int, std::allocator<int> >}::_M_get_Tp_allocator‘ in ‘std::vector<int>::_Base {aka struct std::_Vector_base<int, std::allocator<int> >}‘
using _Base::_M_get_Tp_allocator;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In instantiation of ‘std::_Vector_base<_Tp, _Alloc>::_Vector_base(const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::_Vector_base<_Tp, _Alloc>::allocator_type = std::allocator<int>]‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:366:18: required from ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]‘
D:\Program Files (x86)\JetBrains\CLion 1.2.1\ClionProjects\untitled\main.cpp:9:36: required from here
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:128:20: error: no matching function for call to ‘std::_Vector_base<int, std::allocator<int> >::_Vector_impl::_Vector_impl(const allocator_type&)‘
: _M_impl(__a) { }
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:128:20: note: candidates are:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:86:2: note: std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = int; _Alloc = std::allocator<int>]
_Vector_impl()
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:86:2: note: candidate expects 0 arguments, 1 provided
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:79:14: note: constexpr std::_Vector_base<int, std::allocator<int> >::_Vector_impl::_Vector_impl(const std::_Vector_base<int, std::allocator<int> >::_Vector_impl&)
struct _Vector_impl
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:79:14: note: no known conversion for argument 1 from ‘const allocator_type {aka const std::allocator<int>}‘ to ‘const std::_Vector_base<int, std::allocator<int> >::_Vector_impl&‘
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:79:14: note: constexpr std::_Vector_base<int, std::allocator<int> >::_Vector_impl::_Vector_impl(std::_Vector_base<int, std::allocator<int> >::_Vector_impl&&)
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:79:14: note: no known conversion for argument 1 from ‘const allocator_type {aka const std::allocator<int>}‘ to ‘std::_Vector_base<int, std::allocator<int> >::_Vector_impl&&‘
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In instantiation of ‘std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = int; _Alloc = std::allocator<int>]‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:366:18: required from ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]‘
D:\Program Files (x86)\JetBrains\CLion 1.2.1\ClionProjects\untitled\main.cpp:9:36: required from here
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:161:33: error: ‘struct std::_Vector_base<int, std::allocator<int> >::_Vector_impl‘ has no member named ‘_M_start‘
- this->_M_impl._M_start); }
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:161:9: error: ‘struct std::_Vector_base<int, std::allocator<int> >::_Vector_impl‘ has no member named ‘_M_start‘
- this->_M_impl._M_start); }
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:161:9: error: ‘struct std::_Vector_base<int, std::allocator<int> >::_Vector_impl‘ has no member named ‘_M_end_of_storage‘
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In instantiation of ‘void std::vector<_Tp, _Alloc>::_M_range_initialize(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator = const int*; _Tp = int; _Alloc = std::allocator<int>]‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:369:36: required from ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]‘
D:\Program Files (x86)\JetBrains\CLion 1.2.1\ClionProjects\untitled\main.cpp:9:36: required from here
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1201:27: error: ‘class std::vector<int>‘ has no member named ‘_M_allocate‘
this->_M_impl._M_start = this->_M_allocate(__n);
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1201:27: error: ‘struct std::_Vector_base<int, std::allocator<int> >::_Vector_impl‘ has no member named ‘_M_start‘
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1202:61: error: ‘struct std::_Vector_base<int, std::allocator<int> >::_Vector_impl‘ has no member named ‘_M_start‘
this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1202:36: error: ‘struct std::_Vector_base<int, std::allocator<int> >::_Vector_impl‘ has no member named ‘_M_end_of_storage‘
this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:1203:28: error: ‘struct std::_Vector_base<int, std::allocator<int> >::_Vector_impl‘ has no member named ‘_M_finish‘
this->_M_impl._M_finish =
^
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h: In instantiation of ‘void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(int, std::size_t) [with _Tp = int; _Alloc = std::allocator<int>; std::size_t = unsigned int]‘:
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:161:33: required from ‘std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = int; _Alloc = std::allocator<int>]‘
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:366:18: required from ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]‘
D:\Program Files (x86)\JetBrains\CLion 1.2.1\ClionProjects\untitled\main.cpp:9:36: required from here
d:\progra~3\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h:174:4: error: ‘struct std::_Vector_base<int, std::allocator<int> >::_Vector_impl‘ has no member named ‘deallocate‘
_M_impl.deallocate(__p, __n);
^
mingw32-make.exe[3]: *** [CMakeFiles/untitled.dir/main.cpp.obj] Error 1
mingw32-make.exe[2]: *** [CMakeFiles/untitled.dir/all] Error 2
CMakeFiles\untitled.dir\build.make:61: recipe for target ‘CMakeFiles/untitled.dir/main.cpp.obj‘ failed
CMakeFiles\Makefile2:66: recipe for target ‘CMakeFiles/untitled.dir/all‘ failed
CMakeFiles\Makefile2:78: recipe for target ‘CMakeFiles/untitled.dir/rule‘ failed
mingw32-make.exe[1]: *** [CMakeFiles/untitled.dir/rule] Error 2
mingw32-make.exe: *** [untitled] Error 2
Makefile:117: recipe for target ‘untitled‘ failed
安装目录也换过,Clion也重装过,MinGW也换过,反反复复搞了一天没搞好,网上也收不到,真是哔了狗了。。
后记:就在要走的时候,我偶然发现了一篇介绍:MinGW中的头文件路径
http://blog.sina.com.cn/s/blog_4f183d960101fjvi.html
看过之后觉得很好,然而并没有什么卵用,我前面的代码能够运行,那么应该其他的环境都是配置好了的,突然脑子里灵光一闪,不会是写vector的时候,Clion默认添加的头文件
#include <bits/stl_bvector.h>
有问题吧,抱着试一试的心态,服用了两个疗程之后(啊呸),抱着试一试的心态,将头文件改为#include <vector>之后果然行了,CWNM。。。
#include <iostream> #include <vector> using namespace std; int main() { std::vector<int> vector1 {2,3,4}; return 0; }
上面的代码是可行的,我搞了一周整天呀。。。。纪念我逝去的一天