C语言 使用 Turbo C++,我如何在 C 中绘制图形?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16582201/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 06:21:39  来源:igfitidea点击:

Using Turbo C++, how I can draw graphics in C?

cturbo-c++

提问by ?ēēpak

I've started work on computer graphics. I am using Turbo C++3.0 as my IDE on Windows 7. The problem I am facing is that it doesn't show me any compile time error if it compiles it from Turbo C++. When I execute its EXE file, it doesn't draw any circle on the screen. It shows me the following error (compile time) if I compile it from a command prompt.

我已经开始研究计算机图形了。我在 Windows 7 上使用Turbo C++3.0 作为我的 IDE。我面临的问题是,如果它从 Turbo C++ 编译它,它不会显示任何编译时错误。当我执行它的 EXE 文件时,它不会在屏幕上绘制任何圆圈。如果我从命令提示符编译它,它会向我显示以下错误(编译时)。

I've installed DOSBox, but it also gives me the same errors. The error I am getting is:

我已经安装了DOSBox,但它也给了我同样的错误。我得到的错误是:

Undefined symbol _circle in module conc.c

Here is my code.

这是我的代码。

#include <stdio.h>
#include <graphics.h>
void main()
{
    int x, y, r;
    int gd = DETECT ,gm;
    initgraph(&gd, &gm, "C:\TC\BGI");
    setcolor(3);
    circle(250, 200, 60);
}

回答by ?ēēpak

As I can see there isn't any fault in your C code. You're probably lacking some knowledge about your IDE (Turbo C++). Turbo C++ 3.0 on Windows 7 is really unimaginable. However, if you want to do this you should set your environment of Turbo C++. Take these simple steps:

正如我所看到的,您的 C 代码没有任何错误。您可能缺乏有关 IDE ( Turbo C++) 的一些知识。Windows 7 上的 Turbo C++ 3.0 实在是难以想象。但是,如果您想这样做,您应该设置您的 Turbo C++ 环境。采取这些简单的步骤:

  • Go to the Menu Bar and click on Options
  • Now Click on Linkerand
  • Choose libraries, Select the Graphic libraries
  • 转到菜单栏,然后​​单击选项
  • 现在点击链接器
  • 选择库,选择图形库

Since you are using it on Windows 7, it won't support full screen mode you should disable it. To do so, go to Environmentand set source tracking to 'Current Window', which has a radio button swap it with 'New Window'.

由于您在Windows 7上使用它,因此它不支持全屏模式,您应该禁用它。为此,请转到环境并将源跟踪设置为“当前窗口”,其中有一个单选按钮将其与“新窗口”交换。



For fullscreen mode support, you can download DOSBOX app. It can even run your old DOS applications.

如需全屏模式支持,您可以下载 DOSBOX 应用程序。它甚至可以运行旧的 DOS 应用程序。

For this you have to install DOSBOX and you need to mount your working directory.

为此,您必须安装 DOSBOX 并且需要挂载您的工作目录。