【发布时间】:2017-04-22 09:45:16
【问题描述】:
我目前正在玩 ncurses。 Ncurses 是我安装的库,不是我自己的文件。我已经做了一些事情,但是使用 IDE 要容易得多,所以我决定使用 CLion(我在 Linux 上,所以不能使用 Visual Studio)。我得到了以下 CMakeLists.txt:
cmake_minimum_required(VERSION 3.6)
project(ncurses)
set(CMAKE_C_STANDARD "${CMAKE_C_FLAGS} -Wall -Werror -lpdcurses")
set(SOURCE_FILES main.cpp ncurses.h)
add_executable(ncurses ${SOURCE_FILES})
我的项目被称为 ncurses,我不知道这是否重要。
我得到了以下 main.cpp
#include <ncurses.h>
int main() {
initscr();
printw("Hello");
refresh();
getch();
endwin();
return 0;
}
但是,我收到以下错误:
/opt/clion/bin/cmake/bin/cmake --build /home/josh/ClionProjects/ncurses /cmake-build-debug --target all -- -j 4
make[2]: *** No rule to make target 'CMakeFiles/ncurses.dir/build'. Stop.
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/ncurses.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
我不明白问题出在哪里。我试过-lncurses 除了lpdcurses,但这也不起作用。它只会在构建时出错,而不是在 IDEA 本身中。
【问题讨论】: