editline/history.h and editline/readline.h not found/working on OSX when trying to compile with developer tools installed already

后端 未结 8 972
情深已故
情深已故 2021-02-02 07:37

I am working on this tutorial on building your own LISP (http://www.buildyourownlisp.com/chapter4_interactive_prompt) and for some reason when I try to compile I get this:

相关标签:
8条回答
  • 2021-02-02 08:19

    I'm on El Capitan, Remove #include <editline/history.h>, and use cc -std=c99 -Wall test.c -ledit -o test works for me.
    Add the flag -ledit before the output flad, it's a linking process, allows the compiler to directly embed calls to editline in your program. Or, you'll get the below error message,

    Undefined symbols for architecture x86_64:
      "_add_history", referenced from:
          _main in prompt-086f90.o
      "_readline", referenced from:
          _main in prompt-086f90.o
    ld: symbol(s) not found for architecture x86_64
    
    0 讨论(0)
  • 2021-02-02 08:19

    I'm on OSX Mavericks and removing the line worked for me:

    #include <editline/history.h>
    
    0 讨论(0)
提交回复
热议问题