当前位置: 技术问答>linux和unix
编译#include<curses.h>时连接出问题,望大家帮忙~~~~~
来源: 互联网 发布时间:2015-01-10
本文导语: 源程序: #include int main() { initscr(); } 出错信息: gcc -o curse curse.c /tmp/ccLOwrc0.o:In function 'main': /tmp/ccLOwrc0.o(.text+0x7):undefined reference to 'initscr()' collect2:ld return 1 exit status Compilation exited abnormally wit...
源程序:
#include
int main()
{
initscr();
}
出错信息:
gcc -o curse curse.c
/tmp/ccLOwrc0.o:In function 'main':
/tmp/ccLOwrc0.o(.text+0x7):undefined reference to 'initscr()'
collect2:ld return 1 exit status
Compilation exited abnormally with code 1 at Sun Dec 8 09:29:49
如果只是:gcc -c curse.c
是可以得到:curse.o
#include
int main()
{
initscr();
}
出错信息:
gcc -o curse curse.c
/tmp/ccLOwrc0.o:In function 'main':
/tmp/ccLOwrc0.o(.text+0x7):undefined reference to 'initscr()'
collect2:ld return 1 exit status
Compilation exited abnormally with code 1 at Sun Dec 8 09:29:49
如果只是:gcc -c curse.c
是可以得到:curse.o
|
gcc -o curse curse.c -lcurses
===============================
注意连上 lcurses
===============================
注意连上 lcurses
|
同意楼上!