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

后端 未结 8 975
情深已故
情深已故 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:16

    The solution for those following along on FreeBSD (might work on other Unices as well):

    #include 
    #include 
    
    #include 
    #include 
    
    ...
    

    And run:

    $ cc test.c -Wall -std=c99 -lreadline -o test
    

    Without "-lreadline" in the compile step it is not linked in and you will get errors about undefined reference to "readline" function.

提交回复
热议问题