As I understand it, you need to configure g++ with the -lncurses argument. But I can not figure out how to do this in JetBrains CLion


In general, I added CMakeLists.txt to the end.

link_directories (/ usr / include /)
target_link_libraries (myprogramname ncurses)

Now mistake

Error opening terminal: unknown.
Process finished with exit code 1

  • Add the desired argument to your CMake configuration. If you really need through the IDE, then in the settings in the CMake section, you can specify parameters. - Pavel Parshin
  • Do you mean linking the executable file with the library ncurses? If so, then through cmake. - Vladimir Gamalyan
  • And where exactly are the cmake parameters specified? In Cmake options ? I already tried to specify -lncurses errors - Herrgott

1 answer 1

CMake has a mechanism for finding modules. Among the standard there are FindCurses :

 set(CURSES_NEED_NCURSES TRUE) find_package(Curses REQUIRED) if (CURSES_FOUND AND CURSES_HAVE_NCURSES_H) include_directories(${CURSES_INCLUDE_DIR}) target_link_libraries (target ${CURSES_LIBRARIES}) endif() 
  • on the last but one line: Cannot specify link libraries for target "curses" which is not built by this project. - Herrgott
  • Replace target name of your target - Pavel Parshin
  • Made. Build successful. But it still does not start. I already posted a mistake in the question - Herrgott
  • This is another question and does not apply to Cmake and the assembly of the application. - Pavel Parshin
  • The "terminal" that is built into clion does not support this. Configure it to launch the same xterm or launch it with handles from the terminal. - KoVadim