Summary
As per @Scott Hunter's and @Some programmer dude's comments to the question, this error indicates that some program tries to execute the command cls
, but cannot find it. Most probably it is either dash
, bash
, sh
, or other similar shell.
Details
Your code suggests that this error is a result of trying to call system("cls")
. But, I wasn't able to get that same message executing this function. I was only able to find that executing it produces slightly different message: sh: 1: cls: not found
. Try to execute the following code:
#include <stdio.h>
int main() {
system("cls");
return 0;
}
in either https://www.w3schools.com/c/tryc.php?filename=demo_compiler or https://ideone.com/ (in ideone you need to select the language "C").
On the other hand, I found that executing the command cls
directly as a shell command (not within a C file) produces exactly the message you wrote: cls: command not found
. Compare: https://ideone.com/XVQg4f
Either way, executing system("cls")
shouldn't work on Linux nor macOS, as per @Some programmer dude's comment. It may work on Windows. If you want to clear the screen on Linux (I don't know about macOS), one way is to use the system("clear")
call. It may not be the right way in your case, but certainly is of the simplest.
If you would like to know more about the system
C function, I recommend reading man 3 system
(available online for example here: https://man7.org/linux/man-pages/man3/system.3.html).
Related questions: