Error when using _M_fill_initialize(static_cast<size_type>(__n), __value); in stl_vector.h

Greetings everyone.
I am a beginner in C++ and I hope I am posting my question on the right board.

I am testing out some code which is mostly comprised of 3rd party libraries. When I try to build the program ( in CodeBlocks ) I get this error :

1
2
3
4
5
6
7
8
stl_vector.h|1137|error: no matching function for call to 'std::vector<std::vector<double> >::_M_fill_initialize(std::vector<std::vector<double> >::size_type, int&)'|

stl_vector.h|1137|note: candidate is:

stl_vector.h|1179|note: void std::vector<_Tp, _Alloc>::_M_fill_initialize(std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = std::vector<double>; _Alloc = std::allocator<std::vector<double> >; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::value_type = std::vector<double>]|

stl_vector.h|1179|note:   no known conversion for argument 2 from 'int' to 'const value_type& {aka const std::vector<double>&}'|


The error happens in "stl_vector.h" , in this function and particular line that I wrote in italics :

1
2
3
4
5
6
7
8
9
10
11

      template<typename _Integer>
        void
        _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type)
        {
	  this->_M_impl._M_start = _M_allocate(static_cast<size_type>(__n));
	  this->_M_impl._M_end_of_storage =
	    this->_M_impl._M_start + static_cast<size_type>(__n);
	  _M_fill_initialize(static_cast<size_type>(__n), __value);
	}


I am completely lost on this one, and any help will be much appreciated. Thank you !
Kind regards, T

Edit :
My browser shows my message in quite a messy way because of long lines of code/compiler messages. If I have to change something so the message will be displayed better, please let me know about it.

@Cubbi - Actually this is the last message. After that it is only : ||=== Build failed: 1 error(s), 27 warning(s) (0 minute(s), 0 second(s)) ===|

I suspect there could be something about the compiler. Because the original library was most likely developed in Visual Studio, while I am using CodeBlocks with GCC MinGW.

A few lines above ( marked as warning not as error made me miss them ), it also says :

1
2
3
4
5
6
7
stl_vector.h||In instantiation of 'void std::vector<_Tp, _Alloc>::_M_initialize_dispatch(_Integer, _Integer, std::__true_type) [with _Integer = int; _Tp = std::vector<double>; _Alloc = std::allocator<std::vector<double> >]':|

stl_vector.h|393|required from 'std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = int; _Tp = std::vector<double>; _Alloc = std::allocator<std::vector<double> >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::vector<double> >]'|

required from here : ( That's the code this line points to ) 

  std::vector< std::vector<double> > lmatii(3,3), cmat(3,3), rhomat(3,3), lmati(3,3), rsmat(3,3), lir(3,3); 


The library is supposed to be tested and operational. The error messages I got are unknown to me, and I don't know how to debug them.
Last edited on
That's not a complete error message. Next line or two should tell you where in your code this library function was invoked incorrectly.
Problem solved.

my initializations of
std::vector< std::vector<double> >
are actually done with 2 numbers, which is a mistake of course. It should be, for example :
lmatii( 3, std::vector<double>(3) )

Thank you and I hope this helps others in future as well.
Topic archived. No new replies allowed.