How do I compile the Sundown Markdown Renderer exa

2019-08-02 16:05发布

Sundown a (formerly) popular Markdown editor includes an examples directory, and I want to play around with it on the command line, but I'm having difficulties.

I navigate to examples, I run gcc sundown.c -o sundown and it complains that I don't have markdown.h. So I dump the contents of the src directory and the html directory into the examples category, and run it.

I then get:

Undefined symbols for architecture x86_64:
  "_bufgrow", referenced from:
      _main in sundown-3bac08.o
  "_bufnew", referenced from:
      _main in sundown-3bac08.o
  "_bufrelease", referenced from:
      _main in sundown-3bac08.o
  "_sd_markdown_free", referenced from:
      _main in sundown-3bac08.o
  "_sd_markdown_new", referenced from:
      _main in sundown-3bac08.o
  "_sd_markdown_render", referenced from:
      _main in sundown-3bac08.o
  "_sdhtml_renderer", referenced from:
      _main in sundown-3bac08.o

What exactly am I doing wrong here? I feel like this should be relatively simple, I'm just at wits end trying to figure out what I'm doing wrong.

1条回答
贼婆χ
2楼-- · 2019-08-02 16:42

you tell gcc where to obtain #include files by adding the parameter:

'-Ipathtoincludes'

you tell gcc where to obtain the needed libraries by adding the parameters:

'-Lpathtoolibrary' and '-lshortlibraryname

note: the -l is lower case 'L'

The library path and library name parameters must be last in the gcc command line, as the linker looks at the linker parameters in the order listed on the command line

查看更多
登录 后发表回答