Defining Classes separate files? HELP

Hi. So I'm practicing on how to create classes the proper way, but it doesn't seem to be working? Here's the source:

MAIN:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <string.h>
#include <math.h>
#include "algebra.h"

using namespace std;


{

int main()
{
    algebra adding;
    cout<< "6 + 7";
    cout<< adding.add(6,7);
    return 0;
}

int math::add(int x, int y)
{
    return x+y;
}


algebra.h file
1
2
3
4
5
6
7
8
9
10
11
12
13
#ifndef ALGEBRA_H
#define ALGEBRA_H


class algebra
{
    public:
        algebra();
        virtual ~algebra();
        add(int x, int y);
};

#endif // ALGEBRA_H 


ALGEBRA.CPP file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "algebra.h"
#include <iostream>

algebra::algebra()
{
    //ctor
}

algebra::~algebra()
{
    //dtor
}
algebra::add(int x, int y)
{
    return x+y;
}


Please help. I don't get why it's not working? What am I doing wrong?
It gave me "algebra.h: No such file or directory". How come this is happening? I clearly made the algebra.h file!
Last edited on
Nevermind, I discovered the problem. For some reason on code::blocks, it created this "src" folder. This src folder messed it all up and so it couldn't find the algebra.h file.
Topic archived. No new replies allowed.