如何导入外部C库?

How to import an external C library?

我想将 GraphViz 用作 C 库 (cgraph),但我不知道如何实际“导入”它。
该文件夹包含 makefile.am,所以我应该使用 automake 来获取 makefile.in 文件。我从那里去哪里?

我对要遵循的实际程序感到很困惑。

只是分享我的经验。我没有post评论的权限,所以我post一个答案供大家参考。我正在使用 ubuntu 20.04.

一开始,

foo.c:4:10: fatal error: graphviz/cgraph.h: No such file or directory
    4 | #include <graphviz/cgraph.h>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.

然后,我安装了 graphviz-dev,它开始工作了。

$ sudo apt-get install graphviz-dev

如果这不是您期望的答案,请告诉我。我将删除此 post。谢谢。