Undefined reference in inlining function.

Hello fellow programmers. I have stumbled across a problem while compiling this code. It says undefined reference to 'radiation(int)' . Any ideas to help?
Here is the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Taking damage
// Demonstrates inlining functions

#include <iostream>

int radiation(int health);

using namespace std;

int main()
{
        int health = 80;
        cout<<"Your health is: "<<health<<"\n\n";

        health = radiation(health);
        cout<<"After radiation exposure, your health is: "<<health<<"\n\n";

        health = radiation(health);
        cout<<"After radiation exposure, your health is: "<<health<<"\n\n";

        health = radiation(health);
        cout<<"After radiation exposure, your health is: "<<health<<"\n\n";

        return 0;
}

inline int radiaton(int health)
{
    return (health/2);
}
You fail at copy-paste
declared radiation
defined radiaton
i am not fully understanding what are you saying...
i think the declaring and the defining are ok..
Line 27: radiaton is a spelling mistake. Not the same as line 6.

(Hint: you can avoid spelling mistakes by copy+paste rather than re-typing).
Ah, yes, i got it now. Thank you very much! but i re-type, to practice myself more, is that not a good way of practice?
Yes and no. Writing code (and testing it too) is certainly necessary, as compared with just reading a book (or tutorial).

But it is the overall syntax and construction of the program where the effort should be placed. Re-typing everyday English words may help with your literary efforts, but is (in my opinion) subtracting valuable time from the overall learning activity.

I think perhaps also relevant is that the use of copy&paste is a valuable part of the things you should be learning. That is, it is useful to copy user-defined names, and doing so encourages the use of meaningful names, whereas if you had to type every single character, it might be tempting to use single-letter variable names and write cryptic mysterious code.
ok bro. Thank you very much for your time :)
Topic archived. No new replies allowed.