S
seema
I have problem compiling this program using GCC(g++)
//bye.h --header file
#ifndef BYE_H
#define BYE_H
void display();
#endif
//bye.C -------- Source
#include "bye.h"
#include <iostream.h>
void display()
{
cout <<"Display the stuff ";
}
//main.cpp -----source
#include <iostream.h>
#include <string.h>
#include "bye.h"
class myclass
{
//mystruct x;
friend void display();
public:
myclass(){
display();
}
};
int main()
{
myclass me;
}
If I compile using g++ main.cpp I get the following error,
/tmp/ccG3OvUb.o: In function `myclass::myclass[in-charge]()':
/tmp/ccG3OvUb.o(.gnu.linkonce.t._ZN7myclassC1Ev+0x7): undefined
reference to `display()'
collect2: ld returned 1 exit status
Can some body explain how to do it
thanks in advance,
Seema Rao
//bye.h --header file
#ifndef BYE_H
#define BYE_H
void display();
#endif
//bye.C -------- Source
#include "bye.h"
#include <iostream.h>
void display()
{
cout <<"Display the stuff ";
}
//main.cpp -----source
#include <iostream.h>
#include <string.h>
#include "bye.h"
class myclass
{
//mystruct x;
friend void display();
public:
myclass(){
display();
}
};
int main()
{
myclass me;
}
If I compile using g++ main.cpp I get the following error,
/tmp/ccG3OvUb.o: In function `myclass::myclass[in-charge]()':
/tmp/ccG3OvUb.o(.gnu.linkonce.t._ZN7myclassC1Ev+0x7): undefined
reference to `display()'
collect2: ld returned 1 exit status
Can some body explain how to do it
thanks in advance,
Seema Rao