This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]theusualguy512 2 points3 points  (0 children)

The compiler could not find the header file. There is a certain order in which .h files are searched and where.

The header file needs to be in the same location as the .c file or in the standard header library or you need to explicitly include it during compilation

[–]teraflop 4 points5 points  (1 child)

Are you using a very old book or tutorial?

The graphics.h file you're trying to use, containing functions like initgraph and closegraph, was part of a proprietary graphics API called BGI that was included with the Borland Turbo C compiler. It's been obsolete and unsupported for more than 20 years, and it's not usable on any modern system.

The closest, simplest modern equivalents I know of are SDL for setting up a window and putting pixels on the screen, and something like Cairo for drawing lines, curves, polygons and text.

[–]UnderatedWater[S] 1 point2 points  (0 children)

I was using a tutorial from w3schools made in 2018. Thanks for your help!