Will not complile no matter what..

I've been trying for ages trying to get this to compile...its a multiple file program in Codeblocks but I keep getting errors. Can anyone help me point out the error its really simple, I just want it to print out some text to the screen. Thanks.

main.cpp
1
2
3
4
5
6
7
8
9
10

#include<iostream>
#include "Songs.h"
//using namespace std;

int main()
{
    Songs song;
    song.printMenu();
}


Songs.cpp
1
2
3
4
5
6
7
8
9
10

#include "Songs.h"

using namespace std;

Songs::printMenu()
{
    cout << "Song Menu" << endl << "0. Done." << endl << "1. Search for Artist." << endl;
    cout << "2. Search for Title." << endl << "3. Search for Album." << endl << "4. Search for title phrase."<< endl;
}


Songs.h
1
2
3
4
5
6
7
8
9
10
11
12
13

#ifndef SONGS_H
    #define SONGS_H
    using namespace std;
    class Songs
    {

        public:
            void printMenu();

    };

#endif 
Last edited on
What kind of errors are you getting? People aren't simply going to sit here and guess...
Sorry about that forgot about those. The errors that codeblocks is returning me are
1
2
3

C:\Users\P7 Songs Program\main.o:main.cpp|| undefined reference to `Songs::printMenu|
||=== Build finished: 1 errors, 0 warnings ===|
Last edited on
It appears that your not linking Songs.cpp to your program. Try creating a new project (choose "Console Application") and be sure to add ALL of your files to it. That way CodeBlocks will handle the linking process for you.
Topic archived. No new replies allowed.