简体   繁体   中英

Clear screen on mac Os X

I am using c++ on Qt creator. I look for a command to clean screen.

I tried system("CLS") and system("clear") but it did not work

I try

 #include <curses.h>
    clear();
    refresh(); 

I got this error:

Undefined symbols for architecture x86_64:
  "_clear", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

[From the source page:] The Curses library is designed for working with the console. Advantages: it is cross-platform. Disadvantages: it doesn't interact well with the standard streams. In other words, you shouldn't mix printf() and the like or cout and the like with Curses. Use Standard I/O or Curses, but not both. (You can still employ Standard I/O with things other than the terminal, of course.)

#include <curses.h>

.
.
clear();
refresh(); // changes will appear on the screen after you call refresh()

You should get the NCurses distribution from here

To use the curses library, you need to link your project with it. In the project file (.pro), add the following line:[@KubaOber]

LIBS += -lcurses

Source

The concept of a "screen" only applies if you're doing a console application.

To use the curses library, you need to link your project with it. In the project file ( .pro ), add the following line:

LIBS += -lcurses

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM