Undefined Reference To...

I'm using multiple files for the time, using Code::Blocks and the GNU compiler.

I have 3 files.

stockmg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef STOCKMG_H 
#define STOCKMG_H

#include <iostream>

using namespace std;

class GameOperation
{
    public:
    void startGame();
 };

#endif


progop.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <string>
#include "stockmg.h"

using namespace std;

        void startGame()
        {
            cout << "===================================" << endl;
            cout << "===Stock Market Game. " << endl;
            cout << "===Programmer: Noah Somberg========" << endl;
            cout << "===Date: 11/2/2012=================" << endl;
            cout << "===================================" << endl << endl;
        }


main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include "stockmg.h"

using namespace std;

int main()
{
    GameOperation opObject;

    opObject.startGame();
    //opObject.quitGame();
    cin.get();
    return 0;
}


When I compile and run, I get the error referencing line 10 of main.cpp saying "undefined reference to 'GameOperation::startGame()' what can I do to fix this?
You shall define the function as

1
2
3
4
void GameOperation::startGame()
{
// other stuff
}
Aha! Thanks!
Topic archived. No new replies allowed.