Thread: Problem with BGI graphics: Linker Error

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    9

    Problem with BGI graphics: Linker Error

    Hey. I had just started work on a certain BGI graphics mini project, when I discovered a totally new problem. Whenever I try to compile the program below, it gets compiled with no errors and no warnings. However, when I try to run the program, I get linker errors related to each of the functions defined in graphics.h

    Code:
    #include<iostream.h>
    #include<conio.h>
    #include<graphics.h>
    #include<math.h>
    #define XINTERVAL 100
    /////////////////////////////////////////////////////////////////////
    void showgraph()
    {
    	int gd=DETECT,gm,currentx,ctr,ctr2;
    	clrscr();
    	initgraph(&gd,&gm,"c:\\tc\\bgi");
    
    	cleardevice();
    	moveto(1,1);
    	currentx=1;
    	setcolor(BLUE);
    
    	ctr2=0;
    	ctr=1;
    	while(getx()<=getmaxx())
    	{
    		line(currentx,1,currentx,getmaxy());
    		ctr++;
    		currentx=XINTERVAL*ctr2+log10(ctr)*XINTERVAL;
    		if(ctr==10)
    		{
    			ctr=1;
    			ctr2++;
    		}
    	}
    
    	getch();
    
    	closegraph();
    	restorecrtmode();
    }
    /////////////////////////////////////////////////////////////////////
    int main()
    {
    	clrscr();
    	showgraph();
    	getch();
    	return(0);
    }
    The program seems simple enough, so I am unable to understand why I should get any errors at all. The problem is that I am writing a BGI graphics program after a very long time, and did not anticipate any problem. Moreover, programs that I had earlier written and compiled correctly, now give me the same errors when I try to run them from within the compiler. What could be the problem? Please help out.

    Compiler: Turbo C++ v3.0
    OS: Microsoft Windows XP, Home Edition, Version 2002, Service Pack 2
    Computer: AMD Athlon XP 2000+, 1.66 GHz, 224 MB RAM
    Last edited by darklord1984; 07-28-2005 at 03:07 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM