无法运行C图形程序
我在桌面系统上开发了一个图形程序。但是当我尝试在惠普康柏笔记本电脑上运行它时,它没有被执行。我使用 Turbo C 开发了它。然后我尝试在笔记本电脑上用 Turbo C 编写一个简单的图形程序,但我遇到的问题是在“initgraph”语句中它无法检测到驱动程序。
你能告诉我可能是什么问题吗?
I have developed a graphic program on a desktop system. But when I tried to run it on the hp compaq laptop it'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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
Turbo-C,就像我的第一个女朋友一样,将永远在我心中占有特殊的位置。
但现在是时候让她离开了。她已经不是你记忆中的那个女孩了,她只是跟不上现代了。当时的她可能很时髦很酷,但她根本无法应对现代潮流。即使是 32 位内存对她来说也是一个真正的挑战。你现在是一个更好的男人了,值得一个真正的女人。去找一个好的 Visual Studio,或者一个好的 GCC 环境。
我并不是说你必须忘记 Turbo-C。我知道她是你的第一个女人,并且永远都很神奇,但是把她的照片放在鞋盒里,每年拿出来的次数不要超过一次。是时候继续前进了,伙计。
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.
听起来它无法检测您拥有哪种显卡。尝试将
graphdriver
参数设置为VGA
或IBM8514
。It sounds like it can't detect what kind of graphics card you have. Try setting the
graphdriver
parameter to eitherVGA
orIBM8514
.在 Turbo c 中转到选项->链接器->库->添加图形库。
这可能有帮助
In Turbo c goto options->Linker->Liabraries-> add Graphics Library.
It might help
我假设所有其他先决条件(例如链接器)都得到满足。
现在,我们知道 BGI 文件夹通常位于以下路径(即,如果您遵循默认安装):
C:\TurboC++\disk\TurboC3\BGI
如您所见,BGI 文件夹位于“TurboC3”内,而不是 TC 内。
因此,您需要在程序中放入的代码如下,
我希望这会有所帮助:) 快乐的图形编程:D
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,
I hope this helps :) Happy graphics programming :D
您需要先初始化图形函数。
下面是初始化的代码。
int gd=检测,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
这将初始化图形。
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.
使您的TC能够运行图形程序的步骤如下:
从TC\BGI文件夹中复制CGA.BGI和EGAVGA.BGI文件并将其粘贴到TC\BIN目录中。
通过单击 TC\BIN\TC.EXE 打开 TC。
点击选项->链接器->库。
选择“图形库”选项,然后按“确定”。
现在您可以在零编译错误的情况下编译图形程序。
谢谢!
The Steps to make your TC able to run graphics program are as follows:
copy CGA.BGI and EGAVGA.BGI files from TC\BGI folder and paste them in TC\BIN directory.
Open TC by clicking on TC\BIN\TC.EXE.
Click on Options -> Linker -> Libraries .
Select the Graphics Library option and Press OK.
Now you can compile your graphics program with Zero Compilation Errors.
Thanks!