Why does not graphics.h have required modules?

Do i need to import them or use another different graphics.h from another version of compiler?

What is the possible solution here?


http://www.docstoc.com/docs/34119635...aphics-Using-C

Page #136


I am trying to compile the code for lineChart but it's tough as I get the following errors upon using the Turbo C 2.01 version.

Linker Error: Undefined symbol '_closeGraphics' in module XYZ.C
Linker Error: Undefined symbol '_openGraphics' in module XYZ.C
Linker Error: Undefined symbol '_pPolymarker' in module XYZ.C
Linker Error: Undefined symbol '_pPolyline' in module XYZ.C
Linker Error: Undefined symbol '_pText' in module XYZ.C


Following is the XYZ.C code:

#include <stdio.h>
#include <GRAPHICS.H>
#include <conio.h>
#include <math.h>

#define WINDOW_WIDTH 600
#define WINDOW_HEIGHT 500

/* Amount of space to leave on each side of the chart */
#define MARGIN_WIDTH 0.05 * WINDOW_WIDTH
#define N_DATA 12

typedef struct { float x, y; } wcPt2;

typedef enum
{ Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec } Months;
char * monthNames[N_DATA] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };

pPolyline ( int n, wcPt2 * pts );
pText ( wcPt2 position, char * txt );
pPolymarker( int n, wcPt2 * pts );

int readData (char * inFile, float * data)
{
int fileError = 0;
FILE * fp;
Months month;

if ( ( fp = fopen(inFile, "r")) == NULL)
fileError = 1;
else {
for (month = Jan; month <= Dec; month++)
fscanf ( fp , "%f", &data[month]);
fclose (fp) ;
}
return fileError;
}

void linechart (float * data)
{
wcPt2 dataPos[N_DATA], labelPos;
Months m;
float mWidth = (WINDOW_WIDTH - 2 * MARGIN_WIDTH) / N_DATA;
int chartBottom = 0.1 * WINDOW_HEIGHT;
int offset = 0.05 * WINDOW_HEIGHT; /* Space between data and labels */
int labelLength = 24; /* Assuminq fixed-width 8-pixel characters */
labelPos.y = chartBottom;

for (m = Jan; m <= Dec; m++) {
/* Calculate x and y positions for data markers */
dataPos[m].x = MARGIN_WIDTH + m * mWidth + 0.5 * mWidth;
dataPos[m].y = chartBottom + offset + data[m];
/* Shift the label to the left by one-half its length */
labelPos.x = dataPos[m].x - 0.5 * labelLength;
pText (labelPos, monthNames[m]);
}
pPolyline (N_DATA, dataPos);
pPolymarker (N_DATA, dataPos);
}

void main (int argc, char ** argv)
{
float data[N_DATA];
int dataError = 0;
long windowID;

if (argc < 2 )
{
fprintf (stderr, "Usage: %s dataFileName\n", argv[0]);
exit();
}
dataError = readData (argv[1], data);
if (dataError)
{
fprintf (stderr, "%s error. Can't read file %s\n", argv[1]);
exit ();
}
windowID = openGraphics (*argv, WINDOW_WIDTH, WINDOW_HEIGHT);
setbkcolor(WHITE);
setcolor(BLACK);
linechart(data);
sleep(10);
closeGraphics(windowID);
}