0

I'm a mac user, and I'm using the XCode developer tools and using CLion as a compiler. When I try to use ncurses and its functions, specifically getch(), I get the following error.

Undefined symbols for architecture x86_64:
"_stdscr", referenced from:
_main in main.cpp.o
"_wgetch", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture x86_64

I've tried to go online and reinstall ncurses, but it hasn't fixed anything. I would greatly appreciate any help.

atline
  • 28,355
  • 16
  • 77
  • 113

1 Answers1

0

First of all, CLion isn't a compiler. It's an IDEA (integrated development environment). As I remember using it last time it uses CMake as a build tool. And CMake uses GCC, Clang, MSVC, whatever under the hood.

As you don't post any code sample I will try to guess the problem. Usually when using ncurses you need to link with it as: -lncurses. For more info you should look man ncurses on your platform. Also check that you don't forget to include the required header. E.g. on my system it's #include <curses.h>.

How to link with ncurses via CMake

dshil
  • 381
  • 2
  • 10