Code: Select all
testMathLib.o: In function `main':
testMathLib.cpp:(.text+0xf): undefined reference to `Add(int, int)'
collect2: ld gaf exit-status 1 terug
(1) Een .cpp-file myMathLib.cpp aangemaakt met daarin de functiedefinities, waaronder dit:
Code: Select all
...
int Add(int a, int b) {
return a + b;
}
...
Code: Select all
#ifndef INC_myMathLib_H
#define INC_myMathLib_H
int Add(int, int);
...
#endif
Code: Select all
...
int main() {
cout << Add(5, 6) << endl;
}