5

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?

genpfault
  • 51,148
  • 11
  • 85
  • 139
MELWIN
  • 1,093
  • 4
  • 12
  • 19

2 Answers2

8

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

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

Morgan Thrapp
  • 9,748
  • 3
  • 46
  • 67
Digital_Reality
  • 4,488
  • 1
  • 29
  • 31
  • 3
    hahahaha, love that you remember this, lol. Apparently people still use TC, Borland should be proud :P – adrin Jan 14 '14 at 10:31
  • @adrin yeah.. stopped using this now but I know I too got trouble using it :D – Digital_Reality Jan 14 '14 at 10:32
  • @Digital_Reality:sad no one find this question useful... :( thank you for the answer sir :) – MELWIN Jan 14 '14 at 10:39
  • @Digital_Reality sir in output i got the message " Graphics not initialized use ('initgraph') . What should I do ??? – MELWIN Jan 14 '14 at 10:43
  • @MELWIN Err.. time changes buddy! :) We have to stick to it.. Anyway when are you moving to new compiler? :D – Digital_Reality Jan 14 '14 at 10:44
  • Um.. I am not sure what might be solution.. but check this link http://www.daniweb.com/software-development/c/threads/76092/bgi-error-graphics-not-initializeduse-initgraph – Digital_Reality Jan 14 '14 at 10:46
3

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

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

Write:

initgraph(&gd,&gm,"..\\BGI);
yageek
  • 4,115
  • 3
  • 30
  • 48
Ash
  • 31
  • 1