Mail Archives: djgpp/1998/11/29/16:39:22
I can't get the following prog to compile:
...
#include <iostream.h>
#include <string.h>
class bog;
class bibliotekar {
public:
void nyt_fagnr(bog *, char *);
char *skaf_fagnr(bog);
};
class bog {
public:
bog(char *, char *, char *);
void vis_bog(void);
friend char
*bibliotekar::skaf_fagnr(bog);
friend void
bibliotekar::nyt_fagnr(bog *,char *);
private:
char titel[64];
char forfatter[64];
char fagnr[64];
};
bog::bog(char *titel, char *forfatter, char *fagnr)
{
strcopy(bog::titel, titel);
strcopy(bog::forfatter, forfatter);
strcopy(bog::fagnr, fagnr);
}
void bog::vis_bog(void)
{
cout << "Titel: " << titel << endl;
cout << "Forfatter: " << forfatter << endl;
cout << "Fagnr: " << fagnr << endl;
}
void bibliotekar::nyt_fagnr(bog *denne_bog, char *andet_fagnr)
{
strcopy(denne_bog->fagnr, andet_fagnr);
}
char *bibliotekar::skaf_fagnr(bog denne_bog)
{
static char fagnr[64];
strcopy(fagnr, denne_bog.fagnr);
return(fagnr);
}
void main(void)
{
bog programmering("C++", "Jamsa", "P101");
bibliotekar bibliotek;
programmering.vis_bog();
bibliotek.nyt_fagnr(&programmering, "P102");
programmering.vis_bog();
}
EOF
It says:
In method 'bog::bog(char *, char *, char *)':
warning: implicit declaration of function 'int strcopy(...)'
undefinied reference to 'strcopy' (5 times)
I'm a total newbie, please help.
--
A penny saved is a penny toward a rock of crack.
-from an AOL account
- Raw text -