[Linker error]

Hi Everyone,

I'm on my final stretch for this program but now im getting something that I cannot for the life of me figure out .....

[Linker error] undefined reference to `checkLR(int, int)' <-- there are 6 of these errors
[Linker error] undefined reference to `checkUD(int, int)' <-- there are 6 of these errors

As this is assignment related I'll be masking some of the names etc so if you see random initials its because of that.

Anyways the problem ive narrowed it down to this function .....

void CM(const list< list<char> > &myList)
{
int x;
int y = 1;
int Branch = 0;
int deadEnd = 0;

for (list< list<char> >::const_iterator itr = myList.begin();
itr != myList.end(); itr++)
{
x =1;
for (list<char>::const_iterator iitr = itr->begin();
iitr != itr->end(); iitr++)
{
if (checkLR(y, x) == 2 && checkUD(y, x) == 2)
//means there are 2 branches
if (GCM(myList, y, x) == 's')
branch = 3;
else
branch = 2;
if (checkLR(y, x) == 2 && checkUD(y, x) == 1)
//means there is one branch
if (GCM(myList, y, x) == 's')
branch = 2;
else
branch = 1;
if (checkLR(y, x) == 2 && checkUD(y, x) == 0)
//means there is no branch
if (GCM(myList, y, x) == 's')
branch = 1;
else
branch = 0;
if (checkLR(y, x) == 1 && checkUD(y, x) == 1)
//means there is no branch
if (GCM(myList, y, x) == 's')
branch = 1;
else
branch = 0;
if (checkLR(y, x) == 1 && checkUD(y, x) == 0 ||
checkLR(y, x) == 0 && checkUD(y, x) == 1)
//means it is a deadend.
if (GCM(myList, y, x) == 's')
branch = 0;
else
deadEnd = 1;

x++;
}
y++;
}
}

now here is checkLR and checkUD note they practically identical so ill only put up one.

int checkUD(const list< list<char> > &myList, int yCoord, int xCoord)
{
int pathWay = 0;

while (GCM(myList, yCoord, xCoord) != '#')
{
int mazePointYU = yCoord;
int mazePointYD = yCoord;

--mazePointYU;
++mazePointYD;

if (GCM(myList, mazePointYU, xCoord) == ' ')
{
pathWay ++;
if (GCM(myList, mazePointYD, xCoord) == ' ')
pathWay++;
return pathWay;
}
else if (GCM(myList, mazePointYD, xCoord) == ' ')
{
pathWay ++;
return pathWay;
}
else
return pathWay;
}
}

any help will much appreciated thanks evryone
ahhhh i think ive got it .... realised as i was changing the names ...... lol
YEP solved ..... lesson learnt

lackOfSleep && noFood == noobMistakes
Just a suggest for further posts, try using the <> format symbol. That way it will be easier to read for any potential repliers.

1
2
3
4
5
6
7
8
#include <iostream>

int main()
{
        std::cout << "Easy to read code\n";
       
        return 0;
}
Topic archived. No new replies allowed.