Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linker error in C. while using <graphics.h> Turbo C++

I have entered the following code in turbo c++.

    #include<graphics.h>
    #include<conio.h>
    int main()
    {
    int gd= DETECT, gm;
    initgraph(&gd,&gm,"D:\\TC\\BGI");
    getch();
    closegraph();
    return 0;
    }

It compiles without any errors and warning. But when I run the program the following errors are displayed

  • Linker Error: Undefined symbol_closegraph in module G1.C
  • Linker Error: Undefined symbol_initgraph in module G1.C

note : The BGI folder is in the path D:\TC\

How can I solve the problem?

like image 265
MELWIN Avatar asked Jan 14 '14 10:01

MELWIN


2 Answers

If you are using Turbo C .. just need to check one option:

Go to Options->Linker->Libraries and check the Graphics Library option

like image 152
Digital_Reality Avatar answered Oct 26 '22 18:10

Digital_Reality


Go to options>>linker>>libraries and instead of:

initgraph(&gd,&gm,"");

Write:

initgraph(&gd,&gm,"..\\BGI);
like image 43
Ash Avatar answered Oct 26 '22 17:10

Ash