gpt4 book ai didi

c - 编译 GCC Ubuntu : undefined reference to 时出错

转载 作者:行者123 更新时间:2023-12-04 19:07:44 28 4
gpt4 key购买 nike

我正在尝试运行一个 C 项目“https://github.com/karimaechihabi/lernaean-hydra/tree/91b480fb633ab4730a2cf1f5573d20d55b39b71e/hydra1/code/ucr-suite”,按照与读取相同的步骤自动生成配置和生成文件我 :

>./autogen.sh \
>./configure \
>make
但是当我运行make文件时,我得到了这个 undefined reference 的错误:
>usr/bin/x86_64-linux-gnu-ld: src/bin_serial-serial_scan.o: in function `main': 
/home/zeraph/lernaean-hydra/hydra1/code/ucr-suite/src/serial_scan.c:143: undefined reference to `init_serial_stats'\
/usr/bin/x86_64-linux-gnu-ld: /home/zeraph/lernaean-hydra/hydra1/code/ucr-suite/src/serial_scan.c:147: undefined reference to `serial_scan'\
collect2: error: ld returned 1 exit status\
make[1]: *** [Makefile:486: bin/serial] Error 1\
make[1]: Leaving directory '/home/zeraph/lernaean-hydra/hydra1/code/ucr-suite'\
make: *** [Makefile:335: all] Error 2

请问有什么帮助吗?
Ps:在运行配置命令生成makefile时,我也收到了这个警告:
>/usr/share/automake-1.16/am/library.am: warning: 'lib/libserial.a': linking libraries using a non-POSIX \
/usr/share/automake-1.16/am/library.am: archiver requires 'AM_PROG_AR' in 'configure.ac'

最佳答案

问题在于 make 依赖项(尝试在构建 lib/libserial.a 之前构建 bin/serial);
解决方案:首先制作 lib/libserial.a,然后再制作 bin/serial。

关于c - 编译 GCC Ubuntu : undefined reference to 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65107217/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com