Undefined reference to error is showing an extra parameter for my function, GTKMM C++ -


i writing snakes , ladders game , defined function called draw_snake follows:

void draw_snake(const cairo::refptr<cairo::context>& cr,                  std::pair<int,int> snake,                  std::vector< std::pair<int,int> > boardcoords); 

when make call function follows:

pair<int, int> snake = make_pair(100,1); draw_snake(cr, snake, boardcoords); 

boardcoords vector of pair<int,int>. error message saying have fourth parameter when call function. error message this:

myarea.cc:(.text+0x7db): undefined reference `myarea::draw_snake(cairo::refptr<cairo::context> const&, std::pair<int, int>, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >)' 

where getting allocator from?

you're misreading error. function has 3 parameters.

undefined reference `myarea::draw_snake(          cairo::refptr<cairo::context> const&,          std::pair<int, int>,          std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > //                  ^ vector's parameters contained in these brackets  ^          ) 

std::vector has default "allocator" parameter. exists when don't specify it.

so error you're getting exact function declared not defined.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -