0

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)
LearnToGrow
  • 1,656
  • 6
  • 30
  • 53
  • possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – n. m. could be an AI Apr 06 '14 at 16:56

2 Answers2

0

[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

S J
  • 57
  • 10
0

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
Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313