FreeType library and “Undefined reference to FT_Init_FreeType”

↘锁芯ラ 提交于 2019-11-30 23:45:08

Those are link errors. If they include a Makefile with the demo you are better off using that. Otherwise, you need to add -L and -l options to your compile command line so the compiler (actually the linker, which gets invoked by the compiler behind the scene) knows where to find the FreeType library.

The -L option gives the path to where the code for the library exists. For example

-L/usr/local/lib  

And the -l option gives the name of the library. The library named with the -l option is specified in a shortened form, that is you leave off the "lib" in the front and the ".a" in the back. So for example, if the FreeType library was stored in file libfreetype.a , it would show in the -l option as

-lfreetype

e.g.:

gcc render.c -I/usr/include/freetype2 -L/usr/local/lib -lfreetype
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!