I might not be able to give full code but I could create a smaller situation. I have an api, say abc which is declared as below in abc.h
extern int abc ( int x, int y = 0);
This api is used at multiple files such as x.cpp, y.cpp and z.cpp.
In file, z.cpp I wanted to use this api along with passing one extra paramter to it. So, I have changed the declaration inside abc.h as :
extern int abc ( int x, int y = 0, int z = 0)
This way, I would not need to change the call to these api calls at files x.cpp and y.cpp. Right? I could easily do my work under 'z' inside definition of abc api. Something like:
int abc(int x, int y, int z) {
...
...
if (z) {
<do_whatever>
}
}
But when I compile it, I see 'undefined reference to `abc' at files x.cpp & y.cpp. What is happening?