I have this program in C language: http://rajababuman.blogspot.com/p/graphics-in-turbo-c.html.
It works fine if I use DOSBOX on my Win7 machine and using TurboC++ and shows me what it's doing. But, how can I run the following graphics program on a Linux machine (where we don't have DOSBOX or turboC++)? PS: DISPLAY environment variable is already set to my local machine's IP address to SHOW me GUI/Graphics on Linux box i.e. if I run "xclock", the clock shows up on my machine successfully.
I know TURBO C is a Windows tool and uses Windows API.
I don't have to use graphics.h header file, if I can get a simple C program on a Linux machine, which when I compile, gives me the same output (as this program is giving me on a Windows machine) on a Linux machine (without me intsalling/using DOSBOX or TurboC).
/////////////////////////////////////////////////////////////////////////////////////////
//Diagram of a car
///////////////////////////////////////////////////////////////////////////////////////
#include<stdio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"");
rectangle(100,200,200,250);
rectangle(220,200,320,250);
rectangle(90,190,330,290);
circle(150,290,30);
circle(270,290,30);
getch();
}
When I compile this program on a Linux machine, I get the following errors:
[koba@server1 lory]$ gcc g.c
g.c:2:21: error: graphics.h: No such file or directory
g.c: In function âmainâ:
g.c:5: error: âDETECTâ undeclared (first use in this function)
g.c:5: error: (Each undeclared identifier is reported only once
g.c:5: error: for each function it appears in.)
g.c:4: warning: return type of âmainâ is not âintâ
[koba@server1 lory]$
[koba@server1 lory]$ cc g.c
g.c:2:21: error: graphics.h: No such file or directory
g.c: In function âmainâ:
g.c:5: error: âDETECTâ undeclared (first use in this function)
g.c:5: error: (Each undeclared identifier is reported only once
g.c:5: error: for each function it appears in.)
g.c:4: warning: return type of âmainâ is not âintâ
[koba@server1 lory]$