0
votes

I have a file bridge.h, which contains a function declaration:

int getDisplayPt();

I also have a .cpp file which calls this function:

int b = getDisplayPt();

It all builds and links beautifully.

Now I need to change the function. The new declaration is:

int getDisplayPt(bool*);

And in the .cpp file:

bool result;
int b = getDisplayPt(&result);

Now I'm getting an error "undefined reference to `getDisplayPt(bool*)'"

I thought that maybe the files are not linked correctly and the function makes a call to some other class. So I changed my .cpp file back:

int b = getDisplayPt();

And now I got this:

error: too few arguments to function 'int getDisplayPt(bool*)'

So I believe that the .cpp is indeed calling the function I thought it was calling. But why won't my code link??

Thanks...

2
Did you also change the definition of getDisplayPt? That's the place in .cpp where its body is. - Angew is no longer proud of SO

2 Answers

2
votes

You have changed the header and the calling code. You will also need to change the definition of the getDisplayPt function.

1
votes

It looks like you either never defined getDisplayPt() or didn't update the file where you defined it.