Hi, I am trying to use graphics.h library on a program, I copied the example of a program that comes in help, however, it does compile but at the time I try to run it, it shows a lot of linker Errors, I really don't know what do they mean and why are there appearing, so, if anyone knows something, I would really appreciate help on this, Thanx
The program I am trying to use is the example to draw a line, here it is:
Code:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int xmax, ymax;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
/* an error occurred */
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
setcolor(getmaxcolor());
xmax = getmaxx();
ymax = getmaxy();
/* draw a diagonal line */
line(0, 0, xmax, ymax);
/* clean up */
getch();
closegraph();
return 0;
}
The linker errors it shows are:
Linking NONAME00.EXE:
Linker Error: Undefined symbol _closegraph in module NONAME00.CPP
Linker Error: Undefined symbol _line in module NONAME00.CPP
Linker Error: Undefined symbol _getmaxy in module NONAME00.CPP
Linker Error: Undefined symbol _getmaxx in module NONAME00.CPP
Linker Error: Undefined symbol _setcolor in module NONAME00.CPP
Linker Error: Undefined symbol _getmaxcolor in module NONAME00.CPP
Linker Error: Undefined symbol _grapherrormsg in module NONAME00.CPP
Linker Error: Undefined symbol _graphresult in module NONAME00.CPP
Linker Error: Undefined symbol _initgraph in module NONAME00.CPP
Thanx again