Class problems

Hi there forums, I'm having a bit of trouble with header files and classes, I continually get the error 'undefined reference to Maths::densityb()'. I've been working on it for hours and I can't seem to figure it out.


Here is the main file:
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45


 #include <iostream>

 #include "maths.h"

  using namespace std;


  void Foperator();


      int main() {

        Foperator();

    }



    void Foperator()
    {


        Maths mo;

        int selector;


        cout << "1 = density calculator-" << endl
        << "2 = Averager-" << endl
        << "not done yet!" << endl;
        cin >> selector;

        switch(selector){
            case 1:
                mo.densityb();
            case 2:
                cout << "not done yet!";
            default:
                cout << "not done yet!";

        }
    }


And the header in question:


1
2
3
4
5
6
7
8
9
10

class Maths
{
    public:

        void densityb();

        void densityc(float mass, float volume);
} mo;


I hope i'm not doing something incredibly stupid, but I need help.
line 10 and 21 you have to scope to the function

It should be void Maths::densityb(){}
and void Maths::densityc( float mass, float volume){}
Thank you so much. you, my friend, are a hero!
Topic archived. No new replies allowed.