Linker Error

After some google searching and forum browsing over the linker error "LNK2019" I've decided to make this forum post.

I'm using SDL to create a 2D Snake game. The problem is coming from the implementation of the Snake itself.
It uses a multidimensional vector, where each sub-vector is a coordinate (x,y) where part of the snake exists. When trying to define, or in any way edit this property, I get the error "LNK2019"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//Snake.h
#include <vector>

using namespace std;

class Snake {
  public:
  Snake();
  bool step();
  void changedirection( short direction );
  vector< vector<short> > getcoords() { return coords; }
  short getlength() { return length; }
  private:
  short length, direction;
  vector< vector<short> > coords;

};



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//Snake.cpp
#include <vector>
#include "Snake.h"

using namespace std;

Snake::Snake()
: coords (), length (1), direction (1)
{
	coords.resize(1);
/*
 * Removing this line fixes the error.  However
 * I need a way to define this property when the
 * object is constructed.
 */
}

// Place holder for step.
bool Snake::step() {
	return true;
}


void Snake::changedirection( short direction ) {
  this->direction = direction;
}


Any help, or guidance in the right direction is appreciated!
- Aaron
MSVC help has information/advice on all compiler and linker messages.
That is the first place I looked, because I always try to exhaust all resources before I make a forum post. However, the documentation for LNK2019 didn't seem relevant, or at least I couldn't find any relevancy. Even the example error messages they showed, although having the same error code, didn't appear similar.
Topic archived. No new replies allowed.