日期:2014-05-16  浏览次数:21076 次

GCC curses动态库链接的错误
#include <stdio.h>
#include <curses.h>

int main()
{
  initscr();
  clear();
  addstr("Hello ,World!");
  move(1,0);
  refresh();
  getch();
  endwin();
}

这个程序链接有错误.
<curses.h>这个文件有个动态库libcurses.dylib.在usr/lib里边.
但是gcc好像找不到.

Undefined symbols for architecture x86_64:
  "_stdscr", referenced from:
  _main in main.o
  "_initscr", referenced from:
  _main in main.o
  "_wclear", referenced from:

------解决方案--------------------
连接curses库

gcc -o main main.c -lcurses