Debugging

I have downloaded a source code for a database system. But there seems to be a problem trying to compile it. Pls help me to debug the errors in this code. This code required a graphics.h header file, so I downloaded it from the internet and tried running the database system, but while compiling, the error popped up for the graphics.h file code and not for the database system code itself. Why is it so, and how can i debug these errors? Where do i put these libaries (grpahics.h and other libraries that are included together with the downloaded package). Is it because the place i put these libraries are not proper that these errors pop up?

The source code that represents these libraries are also quite long, so how do I get ur help in debugging these errors ?
There are 102 errors for the graphics.h header file, and 54 errors for the DDGRAPH.H header file.
Below is the source code for the DDGRAPH.H header file and below that is the error for the coding.

void graph()
{
// request auto detection
int gdriver = DETECT, gmode, errorcode;

// initialize graphics mode
initgraph(&gdriver, &gmode, "x:/cpp/bgi");
cleardevice();
setbkcolor(0);
// read result of initialization
errorcode = graphresult();

if (errorcode != grOk) //* an error occurred *
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); //* return with error code *
}
}

The errors for the coding :

-------Configuration: database2 - Win32 Debug-------
Compiling...
database2.cpp
c:\program files\microsoft visual studio\vc98\include\ddgraph.h(4) : error C2065: 'DETECT' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddgraph.h(7) : error C2065: 'initgraph' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddgraph.h(8) : error C2065: 'cleardevice' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddgraph.h(9) : error C2065: 'setbkcolor' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddgraph.h(11) : error C2065: 'graphresult' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddgraph.h(13) : error C2065: 'grOk' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddgraph.h(15) : error C2065: 'grapherrormsg' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(1) : error C2079: 'ii' uses undefined union 'REGS'
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(1) : error C2079: 'oo' uses undefined union 'REGS'
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(4) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(4) : error C2228: left of '.ax' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(5) : error C2065: 'int86' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(6) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(6) : error C2228: left of '.ax' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(10) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(10) : error C2228: left of '.ax' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(15) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(15) : error C2228: left of '.ax' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(20) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(20) : error C2228: left of '.ax' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(22) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(22) : error C2228: left of '.bx' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(23) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(23) : error C2228: left of '.cx' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(24) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(24) : error C2228: left of '.dx' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(28) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(28) : error C2228: left of '.ax' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(30) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(30) : error C2228: left of '.cx' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(31) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(31) : error C2228: left of '.dx' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(35) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(35) : error C2228: left of '.ax' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(37) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(37) : error C2228: left of '.cx' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(38) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(38) : error C2228: left of '.dx' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(42) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(42) : error C2228: left of '.ax' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(44) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(44) : error C2228: left of '.cx' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(45) : error C2228: left of '.x' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddmouse.h(45) : error C2228: left of '.dx' must have class/struct/union type
c:\program files\microsoft visual studio\vc98\include\ddtxtbox.h(6) : error C2065: 'setfillstyle' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddtxtbox.h(7) : error C2065: 'bar' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddtxtbox.h(9) : error C2065: 'setcolor' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddtxtbox.h(10) : error C2065: 'line' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddfun.h(41) : error C2065: 'outtextxy' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddfun.h(53) : error C2065: 'settextstyle' : undeclared identifier
c:\program files\microsoft visual studio\vc98\include\ddfun.h(63) : error C2143: syntax error : missing ';' before '}'
c:\program files\microsoft visual studio\vc98\include\ddfun.h(71) : error C2065: 'delay' : undeclared identifier
c:\windows\system32\database2.cpp(23) : error C2065: 'closegraph' : undeclared identifier
c:\windows\system32\database2.cpp(91) : error C2065: 'clrscr' : undeclared identifier
Error executing cl.exe.

database2.obj - 54 error(s), 0 warning(s)
[9220 byte] By [__gini2] at [2007-11-20 3:28:10]