I am trying to learn C++. Presently I am following a book called “Object Oriented Programing in C++” fourth edition (by Robert Lafore). In this book on page number 225 there is an example about object and classes. I have share the example below, and have manage to download included files and extracted them in to the project folder. So now my project file is contains a file called “msoftcon.c ” and “msoftcon.h”. When I try to compile the project I get an error “undefined reference to ‘init_graphics()’ ”, whereas this function is very much in msoftcon.c. Example is as follow:
#include <iostream>
#include "msoftcon.h"
using namespace std;
class circle
{
protected:
int xCo, Yco; //coordinates of center
int radius;
color fillcolor; //color
fstyle fillstyle; //fill pattern
public:
void set(int x, int y, int r, color fc, fstyle fs)
{
xCo = x;
Yco = y;
radius = r;
fillcolor = fc;
fillstyle = fs;
}
void draw()
{
set_color(fillcolor); //set color
set_fill_style(fillstyle); //set till
draw_circle(xCo, Yco, radius); //draw solid circle
}
};
int main()
{
init_graphics();
return 0;
}