编译库时出现'undefined reference'错误

Ang*_*gus 3 c unix

我在我的代码中添加了第三方库,并在运行时遇到这样的错误make.请帮我理解这个错误.

(.text+0x9b4): undefined reference to `snd_strerror'
/home/bet/Tent/tun/app/Common/hl/lib/libGHAL.a(gfxhal.o): In function `GFX_create_region':
/home/bet/Tent/tun/app/Common/hl/src/GHAL/gfxhal.c:1141: undefined reference to `my_key_handler'
/home/bet/Tent/tun/app/Common/hal/src/GHAL/gfxhal.c:1141: undefined reference to `create_window'
collect2: ld returned 1 exit status
make[2]: *** [all] Error 1
make[2]: Leaving directory `/home/bet/Tent/tun/app/Common/c_app'
make[1]: *** [ctv_all] Error 2
make[1]: Leaving directory `/home/bet/Tent/tun/app/Common'
Run Code Online (Sandbox Code Playgroud)

Alo*_*ave 7

这些是链接错误,它告诉您链接器无法找到您正在使用的库的定义.
您必须将库链接到项目.

gcc <your files for compilation> -lLibName
Run Code Online (Sandbox Code Playgroud)

阅读本文以便更好地理解.