0

When I add getch() to my two functions I got errors stating:

"Undefined symbol: _stdscr" and "Undefined symbol: _wgetch"

I am using a MacBook with the library #include <curses.h> in Xcode

Thanks in advance.

Geno C
  • 1,401
  • 3
  • 11
  • 26
John Tasci
  • 33
  • 4
  • Seems like [`getch()`](https://en.wikipedia.org/wiki/Conio.h) might not be a good idea. Try using C++ [`std::cin`](https://en.cppreference.com/w/cpp/io/cin) instead. If you must use C, then [`getchar()`](https://en.cppreference.com/w/cpp/io/c/getchar) will work on your platform. – Mansoor Aug 25 '20 at 17:17

1 Answers1

0

Just add -lcurses option (link directive) while compiling.

For example : clang++ main.cpp -o main -lcurses

If you are using make then add LDLIBS = -lcurses to your makefile.

I just noticed that you are using XCode. So here you go : Linking Libraries in Xcode. Just replace -lfftw3 in the answer by -lcurses.

brc-dd
  • 10,788
  • 3
  • 47
  • 67
  • How do I do that? I'm new to c++. – John Tasci Aug 27 '20 at 19:41
  • @JohnTasci I had mentioned a link, it has step by step procedure on how to do that. Have you tried going through that? If yes, can you be more specific about what problem are you encountering then? – brc-dd Aug 28 '20 at 07:56