Question: Add.cpp

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

```

Main.cpp

```
#include <iostream>

int main()
{
    using namespace std;
    cout << "The sum of 3 and 4 is: " << add(3, 4) << endl;
    return 0;
}

```

When I try to compile this program I get an error message for line 6 of main.cpp that states: "error: 'add' was not declared in this scope".

Answer: 
Create a header file

Contents:

```
    int add(int x, y);

```

Include that file main.cpp

i.e. #include "headerfile.h"

Then the rest is up to the compiler environment. Basically need to compile each .cpp to object code and then link them. You need to read up about this as this differs between environment. Also read up on header guards and also stuff like graadle, SCONS, Makefiles. Also good to learn about version control systes e.g. mercurial.

Guess you going to have a busy day
In c++ the scope is all visible functions/methods and variables. In order for it to be seen in the scope in this instance you would have to create a header file that contains your method "add". One way to do this would be to instead of having it in a .cpp file have it in a .h file, then include that .h file in your main.cpp file like this

```
#include "Add.h"

```