By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,650 Members | 812 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,650 IT Pros & Developers. It's quick & easy.

how can one resolve a linking problem in c graphics.h

P: n/a
Expand|Select|Wrap|Line Numbers
  1. void main()
  2. {
  3.     int gd=DETECT,gm;
  4.     initgraph(&gd,&gm,"c:\\tc\\bgi");
  5.     setcolor(GREEN);
  6.     settextstyle(4,0,8);
  7.     outtextxy(200,50,"TIME");
  8.     setcolor(YELLOW);
  9.     settextstyle(4,0,8);
  10.     outtextxy(100,190,"SCHEDULER");
  11.     settextstyle(1,0,1);
  12.     setcolor(RED);
  13.     outtextxy(480,350,"Made By:");
  14.     setcolor(BLUE);
  15.     outtextxy(480,370,"Atiq Anwar");
  16.     getch();
  17.     restorecrtmode();
  18. }
  19.  
  20.  
  21. error-
  22. linking error..undefined symbol setcolor
  23. linking error..undefined symbol settextstyle
  24. linking error..undefined symbol outtextxy
  25. linking error..undefined symbol restorecrtmode
  26. linking error..undefined symbol initgraph
  27.  
  28.  

plzzzzzz help thnx alot
Oct 24 '10 #1
Share this Question
Share on Google+
2 Replies


weaknessforcats
Expert Mod 5K+
P: 9,197
For example, you are using a symbol setcolor and the compiler doesn't know what that is.

I don't know what that is either. Is a a variable? a function?

You cannot use any symbol unless you have first declared what it is.

Maybe you are missing a header file.

BTW: main() returns int not void.
Oct 24 '10 #2

Expert 100+
P: 2,398
This is a linker error, not a compiler error. That is, you are including the right header. This header promises the compiler that these functions exist and that they will be available for the link editor phase. However, the link editor can't find those functions so it complains that you broke your promise.

Typically, promised external functions like these are either provided in an object file or an object library. The method of providing either of these varies by compiler.

In gcc, you specify an object file by including it on the command line with all of the other input files; you specify an object library with the -l command line switch.
Oct 24 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.