int gd=0,gm;
 Error:fatal error: graphics: No such file or directory

Recommended Answers

All 4 Replies

Are you sure the library is called graphics and the files for that library are installed on the computer?

Tell a big more. Which compiler, OS and what else we would need to know to duplicate this issue.

Try changing line 1 to:

#include <graphics.h>

In C, it's conventional to use ".h" as a suffix for a C header file; and that is the name of the Borland Graphics Interface header that defines functions named initgraph(), circle() and closegraph().

It's not a Standard C header, though, so unless you have an old copy of Turbo C or compatible, or have installed a compatible library on a modern compiler, that won't help. If you're in a class that gave you a setup procedure to install C on your computer for classwork, then fixing the include directective should get you started.

You may need other headers at some point. I include both <stdio.h> and <stdlib.h> in practically every C program I write. Also, programs that use <graphics.h> will also often use low-level console functions defined in <conio.h>, which is another common nonstandard header from last century. If you see something telling you to use getch() or kbhit(), then you probably need <conio.h> included.

commented: The OP commented " i use Code Blocks IDE Windows 10 Pro" but they appear to have removed this information. +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.