FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


clrscr() function





baboosaa
i use Dev-C++ compiler for C programming.
everything was well but when i tried to use the function clrscr() function and compile a program then an error occurred. i had used both <stdio.h> and <conio.h> header files . i could find out what was wrong

the error displayed is given below

[Linker error] undefined reference to 'clrscr'
Id returned 1 exit status

PS
but turbo c++ complies the same program without any error message.

any suggestions will be welcomed
Peterssidan
I think conio.h is only available on Borland's compilers.
Maybe you can implement the function yourself or use another library like ncurses.
rayxzero
baboosaa wrote:
i use Dev-C++ compiler for C programming.
everything was well but when i tried to use the function clrscr() function and compile a program then an error occurred. i had used both <stdio.h> and <conio.h> header files . i could find out what was wrong

the error displayed is given below

[Linker error] undefined reference to 'clrscr'
Id returned 1 exit status

PS
but turbo c++ complies the same program without any error message.

any suggestions will be welcomed


Or you can do system("cls");
SultanMA
I think there is no need for clrscr() ................
Peterssidan
SultanMA wrote:
I think there is no need for clrscr() ................

Can you please say why, and what can be used instead?
SonLight
Peterssidan wrote:
SultanMA wrote:
I think there is no need for clrscr() ................

Can you please say why, and what can be used instead?


I'll let SultanMA say what his or her reasons are, but I think there are many who program only GUI applications and might think clrscr() and cls are no longer useful. Obviously some means of clearing a textbox is necessary with a GUI, but that's handled much differently.

If the clrscr() statement compiled with neither warnings nor errors but failed at load time, it would mean it is not in the library. There has to be some function which is described as clearing the screen, the terminal, or the terminal window. [Yes, terminology has changed a bit since the old DOS days, even though the function is the same.]

baboosaa, if you're compiling a command line program [aka console program] there should be some library function which clears the screen. You need to check the Dev-C++ documentation or do a web search for the right name. Incidentally, there ought to be a compiler warning if you use the compiler option that warns about use of an undefined function. I recommend turning on most compile-time errors as an aid in debugging your program.

As a curiosity, I tried the 'cls' command on my system (Ubuntu Linux) and it wasn't recognized. 'clear' worked fine, but 'clear_console' told me my terminal window is not a console!
Related topics
Reply to topic    Frihost Forum Index -> Computers -> Software

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.