Dev C++ 5.4.2 上的 clrscr() 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18766159/
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-08-27 22:11:43  来源:igfitidea点击:

Error with clrscr() on Dev C++ 5.4.2

c++

提问by Zaid Khan

While programming C on the old Turbo C++ compiler I can use the clrscr() method of the "conio.h" header file but not on Dev C++ 5.4.2.(It gives an unusual error Id returned 1 exit status. Although it has nothing to do with the clrscr() and When I removed the clrscr() statement it works perfectly fine! ) So, has the method clrscr() method got deprecated. What is the meaning of the error ?

在旧的 Turbo C++ 编译器上编程 C 时,我可以使用“conio.h”头文件的 clrscr() 方法,但在 Dev C++ 5.4.2 上不能。(它给出了一个异常错误 Id 返回 1 退出状态。虽然它有与 clrscr() 无关,当我删除 clrscr() 语句时,它工作得非常好!)因此,clrscr() 方法是否已被弃用。错误的含义是什么?

enter image description hereOne more question is "are compiler and library of a language associated". So for a particular compiler a corresponding library is like binded to it.

在此处输入图片说明还有一个问题是“一种语言的编译器和库是否相关联”。因此,对于特定的编译器,相应的库就像绑定到它。

回答by Sebastian Redl

clrscr()didn't get deprecated because it was never part of any standard. It was a vendor-specific function provided as an extension by Borland in the (also non-standard) <conio.h>header. Modern compilers no longer provide this function.

clrscr()没有被弃用,因为它从来不是任何标准的一部分。它是由 Borland 在(也是非标准)<conio.h>标头中作为扩展提供的特定于供应商的功能。现代编译器不再提供此功能。

There's a couple of ways to emulate it, and I'm sure you can find it here - just look at the links in the Related section on the right side.

有几种方法可以模拟它,我相信您可以在这里找到它 - 只需查看右侧相关部分中的链接即可。

回答by ritesh anand

please include stdlib.h file and then call system("cls") and enjoy.

请包含 stdlib.h 文件,然后调用 system("cls") 并享受。

#include<stdlib.h>

system("cls");

回答by Muhammad Abbas

you can use system("cls");instead of clrscr();

你可以使用system("cls");代替clrscr();

回答by amol

system("cls");works fine instead of clrscr();

system("cls");工作正常而不是 clrscr();

回答by udit043

clrscr()will not work untill you download & link conio.o in your project. Download conio.h , conio.o & then copy paste conio.h in include folder & conio.o in lib folder. Link conio.o in your project (Project->Project option->Parameters->Add Library or Object) .. Then run it.

clrscr()除非您在项目中下载并链接 conio.o,否则将无法使用。下载 conio.h , conio.o 然后将 conio.h 复制粘贴到包含文件夹中,然后将 conio.o 复制到 lib 文件夹中。在您的项目中链接 conio.o (Project->Project option->Parameters->Add Library or Object) .. 然后运行它。

回答by SingerOfTheFall

The Conio.hheader is not a part of C Standard Libary. According to wikipedia:

Conio.h标头不是C标准Libary的一部分。根据维基百科:

conio.h is a C header file used mostly by MS-DOS compilers to provide console input/output.1It is not described in The C Programming Language book, and it is not part of the C standard library, ISO C nor is it defined by POSIX.

conio.h 是一个 C 头文件,主要由 MS-DOS 编译器用于提供控制台输入/输出。1在 The C Programming Language 一书中没有描述它,它不是 C 标准库、ISO C 的一部分,也不是由 POSIX 定义的。

So you just don't have this header.

所以你只是没有这个标题。

The errors you are getting are linker errors reporting that it can't find the clrscr()function in any of the headers that hare available for it.

您收到的错误是链接器错误,报告它无法clrscr()在任何可用的头文件中找到该函数。

Also, check this question.

另外,检查这个问题。