编译库时出现’undefined reference’错误
发布时间:2020-12-16 09:40:12 所属栏目:百科 来源:网络整理
导读:我在我的代码中添加了第三方库,并在运行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/
我在我的代码中添加了第三方库,并在运行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' 解决方法
这些是链接错误,它告诉您链接器无法找到您正在使用的库的定义.
您必须将库链接到项目. gcc <your files for compilation> -lLibName 阅读this以便更好地理解. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |