开发者

In Xcode how do I specify the correct library in my project settings to avoid a link error?

I get a Undefined symbols error att开发者_运维问答empting to build an XCode project, and I'm pretty sure it is because the linker can't find a library (it's the library needed to use curses.h btw). I'm writing a terminal program. The errors I'm getting are:

Undefined symbols:
  "_initscr", referenced from:
      _main in RogueSmackCmdLine.o
  "_wrefresh", referenced from:
      _main in RogueSmackCmdLine.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

and the offending lines of code are:

WINDOW *win = initscr ();
wrefresh(win);

This oughta be easy for some of you guys. Help finding the right place in the Project Settings and knowing what to put there wd be greatly appreciated.


Looks like those are from ncurses. You should right-click on your Frameworks folder in Xcode's file browser, select Add->Existing Frameworks…, and select libncurses (or libcurses) from the list.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜