2012-05-13 2 views
1
"/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 라이브러리를 추가했습니다.kbhit 테스트를 컴파일하지 못했습니다. 'lcurses'를 찾을 수 없습니다.

필자는/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; 
} 

어떤 도움을 유쾌하게 환영받을 것이다; 나는 길을 잃었다.

답변

0

이것은 C++ 코드에 문제가되지 않습니다. 빌드 환경에 더 문제가 있습니다. netbeans IDE를 사용하고 있습니까?

내가 말할 수있는 한이 코드는 ncruses와 NetBeans의 링크 지시문을 필요로하지 않습니다. 당신이 ncruses.h 파일을 가리 키도록 설정했습니다.이 파일은 "-Wl, -lncurses"또는 "-lncurses"와 같아야합니다. 그래서 추측은 네브라스카 어딘가에 네가 ncruses 대신에 ncruses.h (분명히는 모르겠다)라고 쓰여진 라이브러리 이름을 지적해야한다는 것이다.

ncurses에 대한 매개 변수 컴퓨터 "pkg-config --libs ncurses"및 "pkg-config --cflags ncurses"

+0

무엇을해야합니까? 네, opensuse에서 넷빈을 사용하고 있습니다. 가장 쉬운 리눅스 배포판 이었기 때문입니다. 나는 네비게이션을 넘어선 내가하는 일을 반드시 알 필요가 없다. 나는 윈도우 용으로 이것을 컴파일 할 수 있기를 원하기 때문에 ncurses를 골랐다. –

+0

오류를 자세히 살펴보면 라이브러리 대신 헤더 파일에 링크하려고 시도하고 있음을 알 수 있습니다. 프로젝트 속성 어딘가에 ncurses (또는 ncurses6 대신에 "pkg-config --libs"행을 실행해야하는 이유) 대신에 ncurses.h를 작성했습니다. 나는 네브라스카를 사용하지 않는다. 정확히 어디서 바꿔야 하는지를 알려주는 문제가있다. –

+0

그냥 ncurses에 관한 다른 질문을 보았다. 여기서는 ncurses.h와 같은 부분을 만들어야한다. "그리고 그것은 단지"ncurses "이어야한다 –

관련 문제