开发者

Cannot run c graphics programs

开发者 https://www.devze.com 2022-12-24 10:14 出处:网络
I have developed a graphic program on a desktop system. But when I tried to run it on the hp compaq laptop it开发者_如何学JAVA\'s not getting executed. I developed it using Turbo C. Then i tried writi

I have developed a graphic program on a desktop system. But when I tried to run it on the hp compaq laptop it开发者_如何学JAVA's not getting executed. I developed it using Turbo C. Then i tried writing a simple graphic program in Turbo C on the laptop, but the problem I am getting is in 'initgraph' statement it is unable to detect the driver.

Can you please tell me what might be the problem?


Turbo-C, much like my first girlfriend, will always have a special place in my heart.

But its time to let her go. She's not the same girl you remember, and just cannot keep up with modern times. She may have been hip and cool at the time, but she can't handle modern trends at all. Even 32-bit memory is a real challenge for her. You're a better man now, and deserve a real woman. Go find yourself a good Visual Studio, or a nice GCC environment.

I'm not saying you have to forget Turbo-C. I know she was your first and will always be magical, but put her pictures in a shoebox, and don't take them out more than once a year. Its time to move on, buddy.


It sounds like it can't detect what kind of graphics card you have. Try setting the graphdriver parameter to either VGA or IBM8514.


In Turbo c goto options->Linker->Liabraries-> add Graphics Library. It might help


I'm assuming that all the other prerequisites like linkers are satisfied.

Now, as we know the BGI folder is usually in the following path(i.e. if you've followed the default installation):

C:\TurboC++\disk\TurboC3\BGI

As you can see the BGI folder is inside "TurboC3" and not TC. So the code you need to put in your program is as follows,

initgraph(&gd, &gm, "C:\\TurboC3\\BGI");

I hope this helps :) Happy graphics programming :D


you need to initialize the graphics function first. below is the code to initialize.

int gd=DETECT,gm; initgraph(&gd,&gm,"c:\\tc\\bgi");

this will initialize the graphics.


The Steps to make your TC able to run graphics program are as follows:

  1. copy CGA.BGI and EGAVGA.BGI files from TC\BGI folder and paste them in TC\BIN directory.

  2. Open TC by clicking on TC\BIN\TC.EXE.

  3. Click on Options -> Linker -> Libraries .

  4. Select the Graphics Library option and Press OK.

  5. Now you can compile your graphics program with Zero Compilation Errors.

Thanks!

0

精彩评论

暂无评论...
验证码 换一张
取 消