动态链接的问题

发布于 2022-10-15 08:59:46 字数 4371 浏览 18 评论 0

我写了一个C库和一个C++库,C++库里调C库函数,但在链接时找不到。如下:

  1. <arm-hisiv200-linux-g++>creating binary "./swapp "
  2. arm-hisiv200-linux-g++   swapp.o swapp_media.o swapp_parameter.o swapp_shell.o swapp_browser.o /work/b500_hi3716/swboot/swboot.o /work/b500_hi3716/swboot/swboot_parameter.o /work/b500_hi3716/swboot/swboot_signal.o /work/b500_hi3716/swboot/swboot_shell.o /work/b500_hi3716/swboot/swboot_nmp.o /work/b500_hi3716/swboot/swboot_hwnmp.o /work/b500_hi3716/swboot/swboot_upgrade.o  /work/b500_hi3716/libs/libswadvertisement.a /work/b500_hi3716/libs/libproductest.a /work/b500_hi3716/libs/hi3716M/libhwiptv.a /work/b500_hi3716/libs/libstb_md5.a /work/b500_hi3716/libs/hi3716M/libswchannel.a /work/b500_hi3716/libs/hi3716M/libswface.a /work/b500_hi3716/libs/libswdiskctrl.a /work/b500_hi3716/libs/libswusbaction.a  /work/b500_hi3716/swapi/libs/hi3716M/sdk/Hi3716MV100R001C00SPC031/libswaudio.a /work/b500_hi3716/swapi/libs/hi3716M/sdk/Hi3716MV100R001C00SPC031/libswvideo.a /work/b500_hi3716/swapi/libs/hi3716M/libswtest.a /work/b500_hi3716/swapi/libs/hi3716M/libswntpclient.a /work/b500_hi3716/swapi/libs/hi3716M/libswcontext.a /work/b500_hi3716/swapi/libs/hi3716M/libWnd.a /work/b500_hi3716/swapi/libs/hi3716M/libWmlPorting.a /work/b500_hi3716/swapi/libs/hi3716M/libswusb.a /work/b500_hi3716/swapi/libs/hi3716M/libiconv.a /work/b500_hi3716/libs/hi3716M/libctclog.a /work/b500_hi3716/swapi/libs/hi3716M/libswmedia2.a /work/b500_hi3716/swapi/libs/hi3716M/sdk/Hi3716MV100R001C00SPC031/libswdec.a /work/b500_hi3716/swapi/libs/hi3716M/libswstrmfilter.a  /work/b500_hi3716/libs/hi3716M/libipanel-hi3716-zh_CN.UTF8-huawei-1081.2.2.2.10037.a  /work/b500_hi3716/libs/hi3716M/libswbrowser30.a -L/work/b500_hi3716/libs/ -lfreetype -ljpeg -lpng12 -liconv -lz -lgif -lskia -lswimagexformer -lswsubtitlescroll  -L/work/b500_hi3716/swapi/libs/hi3716M -lswcwmp_monitor -lswcwmp_core -lswcwmp_generic -lswcfglib -lswnmp -lswxml -L/work/b500_hi3716/swapi/libs/hi3716M -lhwdownloader   -L/work/b500_hi3716/swapi/libs/hi3716M -lswupgrade -lswfiledownloader -lswstorage  -L/work/b500_hi3716/swapi/libs/hi3716M -lswfont -L/work/b500_hi3716/swapi/libs/hi3716M -lswpartition -lswflash -lswparameter -lswlogo -lswstorage   -L/work/b500_hi3716/swapi/libs/hi3716M/sdk/Hi3716MV100R001C00SPC031 -lswscreen -lswgraphics -lswpcmplayer -lswgpio -lswe2prom  -L/work/b500_hi3716/swapi/libs/hi3716M -lswmsgbox -lswplaylist -lswftp -lswhttp -lswshell -lswfile -lswimage -lsw_hwnmp -lswnmp -lswsys -lswir -lswdhcp -lswutil -lswlog -lswmem -lswqueue -lswreg -lswi18n -lswmsgbox -lswos -lswnetmanager -lswhashmap -lswxml  -L/work/b500_hi3716/swapi/libs/hi3716M -lswled -L/work/b500_hi3716/swapi/libs/hi3716M -lswpppoe -lpppd -L/work/b500_hi3716/swapi/libs/hi3716M -lswwifi -L/work/b500_hi3716/swapi/libs/hi3716M/rp-pppoe.so  -ldl -L/work/b500_hi3716/swapi/libs/hi3716M/thirdparty/ -lavformat -lavutil -lavcodec  -lpthread  -lm -lrt -ldl -L/work/b500_hi3716/swapi/libs/hi3716M/sdk/Hi3716MV100R001C00SPC031/hisi -lhigo -lhigoadp -ltde -lhi_mpi -lhi_ecs -lhi_common -lhipng -ljpge -lhijpeg -lfreetype -lz   -o ./swapp  && chmod a+x ./swapp
  3. /work/b500_hi3716/libs//libswimagexformer.so: undefined reference to `sw_graphics_on_time_return'
  4. /work/b500_hi3716/swapi/libs/hi3716M/sdk/Hi3716MV100R001C00SPC031/hisi/libhigoadp.so: undefined reference to `FTC_SBitCache_LookupScaler'
  5. collect2: ld returned 1 exit status
  6. make: *** [swapp] 错误 1

复制代码察看符号表:

  1. root@ubuntu:/work/b500_hi3716/swapp# nm ../libs/libswadgraphics.so | grep sw_graphics_on_time
  2. 00000778 T sw_graphics_on_time_exit
  3. 00000800 T sw_graphics_on_time_init
  4. 000008d0 t sw_graphics_on_time_proc
  5. 000007c0 T sw_graphics_on_time_refresh
  6. 0000075c T sw_graphics_on_time_return

复制代码

  1. root@ubuntu:/work/b500_hi3716/swapp# nm ../libs/libswimagexformer.so | grep sw_graphics_on_time
  2.          U sw_graphics_on_time_return

复制代码我用gcc和g++链接都不行,在头文件里也声明 EXTERN C了。

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

花开柳相依 2022-10-22 08:59:46

呵呵 是链接顺序的问题。这个问题应经解决了。谢谢了。

〃安静 2022-10-22 08:59:46

以前遇到过,因为库之间相互依赖,又不知道依赖的顺序,用Xlinker就自动解决了

  1. -Xlinker "-(" $(LDFLAGS) -Xlinker "-)"

复制代码

痴情换悲伤 2022-10-22 08:59:46

以前遇到过,因为库之间相互依赖,又不知道依赖的顺序,用Xlinker就自动解决了
lli_njupt 发表于 2011-04-21 13:32

除了依赖顺序问题,还会有其他原因造成这样的错误吗?

正遇到这样的问题,解决不了

迷荒 2022-10-22 08:59:46

我也遇到了同样的问题,已经使用了-Xlinker ,所以可以排除是依赖顺序的问题,但是发现还是会提示
undefined reference to xxxxx,并且确定正确指定了该库的路径!请高人指点

撩起发的微风 2022-10-22 08:59:46

能给我hi3716的电路图吗?我要用到JTAG

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文