I am trying Nintendo DS programming, and I have a main.cpp file, a snake.h file and a snake.cpp file. When I compile (using the Makefile) I got
/home/david/Dropbox/sources/ds/04_snake/source/snake.cpp:228: undefined reference to `printBlock(int, int, unsigned short, int)'
/home/david/Dropbox/sources/ds/04_snake/source/snake.cpp:230: undefined reference to `printBlock(int, int, unsigned short, int)'
that are errors in this function
void drawSnake(game g) {
int i;
printBlock(g->s->last[0], g->s->last[1], g->bgColor, g->block);
for(i=0; g->s->points[i][0]!=-1 && i<MAXLENGHT; i++)
printBlock(g->s->points[i][0], g->s->points[i][1], g->s->color, g->block);
return;
}
But in the same file, about 100 lines before, I have
int printBlock(game g, int x, int y, u16 color, int thickness) { /*code*/ }
And if I comment the lines where I use printBlock (in the drawSnake function) the code compiles without errors. I tried to change name, to change positions, but I can't figure why only that function gives me error.
That's a different function (five arguments instead of four).
You probably meant to call it like this:
(The same goes for the other call site.)