"/usr/bin/gmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
gmake[1]: Entering directory `/home/josh/Projects/Testing grounds/kbhit'
"/usr/bin/gmake" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/kbhit
gmake[2]: Entering directory `/home/josh/Projects/Testing grounds/kbhit'
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/main.o.d
g++ -c -g -Iusr/include/ -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++ -o dist/Debug/GNU-Linux-x86/kbhit build/Debug/GNU-Linux-x86/main.o -L/usr/include/ncurses -L/usr/include/ncurses6 -L/usr/include/ncursesw -lncurses.h
/usr/lib64/gcc/x86_64-suse-linux/4.6/../../../../x86_64-suse-linux/bin/ld: cannot find -lncurses.h
collect2: ld returned 1 exit status
gmake[2]: *** [dist/Debug/GNU-Linux-x86/kbhit] Error 1
gmake[2]: Leaving directory `/home/josh/Projects/Testing grounds/kbhit'
gmake[1]: *** [.build-conf] Error 2
gmake[1]: Leaving directory `/home/josh/Projects/Testing grounds/kbhit'
gmake: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 477ms)
它似乎找不到“lcurses”,但我从未定义它来寻找 lcurses。我实际上添加了要链接的 ncurse 库。
我已经导航到 /usr/include/ncurses 并且实际上应该有文件。
我不完全知道整个编译过程中发生了什么,这超出了我的范围。我只知道有人告诉我链接我需要的库。ncurses.h 这就是我的代码。
#include <iostream>
#include <ncurses/ncurses.h>
using namespace std;
bool kbhit()
{
int ch = getch();
if(ch != ERR)
{
ungetch(ch);
return true;
}
return false;
}
int main() {
while(!kbhit())
{
cout << "no input";
}
cout << "Mummy, it's over.";
return 0;
}
欢迎任何帮助;我搞不清楚了。