New to Classes

I have the following code..

1
2
3
4
5
6
7
int main
{
 MediaClass m1;
 m1.InputMedia();
 m1.DisplayMedia();
 return 0;
}


I am getting an error saying:
"undefined reference to 'MediaClass::InputMedia()'
"undefined reference to 'MediaClass::DisplayMedia()'

What am i doing wrong? I have never used classes before
There's a number of things you could be doing wrong.
Did you define MediaClass' methods?
If it's a class from a library, are you linking to the static library?
ihave media2.h which has the class and its member functions..
inside MediaClass.cpp (where that code was) i have #include "media2.h"
im not sure what you mean by linking it?

I changed this.. i had

void InputMedia()
{}
and i changed it to
void MediaClass::InputMedia()
{}

is this what you meant? cause it works now
Last edited on
Yes, that's what I meant when I said
Did you define MediaClass' methods?
Topic archived. No new replies allowed.