The graphics.h header file is not running in turbo c++ 4.5, why?

#include<graphics.h>
#include<conio.h>

void main()
{
    int gd=DETECT, gm;

    initgraph(&gd, &gm, "c:\\turboc3\\bgi " );
    circle(200,100,150);

    getch();
    closegraph();
}

Please give me a link to download c-graphics tutorial?

Dani AI

Generated

This thread illustrates a classic BGI/Turbo C++ issue. posted a typical old-school graphics example, pointed to general tutorials, and confirmed a local fix. Extra context, a short troubleshooting checklist, and safer long-term options follow.

  • Understand what graphics.h needs: it is the Borland BGI system (nonstandard and DOS-era). The header alone is not enough — runtime driver files (.bgi) and a DOS-compatible runtime environment are required for the graphics subsystem to initialize.
  • Quick checklist (most common causes):
    • Verify the BGI driver files are present and accessible from the path passed to the graphics initializer, or place them in the program/executable folder so the library can find them.
    • Make sure the path string is correct (no stray trailing space) and points to the directory containing the .bgi files; on modern toolchains also confirm escaping/backslashes according to the compiler.
    • Run Turbo C++ and compiled programs inside a DOS emulator on modern Windows (Turbo C++ is a DOS program and will not run natively on 64‑bit Windows).
    • If using a modern IDE/compiler, use a BGI port (see links below) rather than trying to run the original Borland binaries natively.
  • Safer, modern alternatives:
    • Use a BGI-for-Windows port (WinBGIm) when the goal is to keep old graphics.h code working with MinGW/Code::Blocks.
    • For learning or new projects, prefer maintained, cross-platform libraries such as SFML or SDL instead of obsolete BGI.

References:

Note: graphics.h is historically useful for learning simple concepts, but it is obsolete and platform-locked. For portability and long-term projects, migrating to modern libraries avoids repeated environment and path headaches.

Recommended Answers

All 2 Replies

Thanks Shankrz
It helpd a lot i was giving Wrong path.
Its working fine for me

Be a part of the DaniWeb community

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