Multiple definition of error

This might be really stupid but I am just starting.
Was trying multiple files.

Here is the code:

Menu.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include<iostream>
#include "Guess the no.cpp"
using namespace std;

int main()
{
    int game;
    cout<<"Welcome to games"<<endl<<endl;
    cout<<"Choose the game you want to play"<<endl<<"1. Guess the no"<<endl<<"2. Race";
    cin>>game;

    switch(game)
    {
    case 1:
        GuessNo();
        break;
    case 2:
        cout<<"Under development";
        break;
    default:
        cout<<"Invalid game";
    }
}


Guess the no.cpp
1
2
3
4
5
6
7
8
#include<iostream>

using namespace std;

void GuessNo()
{
    cout<<"Almost ready";
}


Compiling gives the error multiple definition of Guess No()

What's the mistake?
Don't #include .cpp files.
Instead make a header file which would contain just the function prototype declaration, void GuessNo(); and include that header file instead.
That helps, thanks chervil!
Topic archived. No new replies allowed.