/usr/bin/x86_64-linux-gnu-ld:找不到? [英] /usr/bin/x86_64-linux-gnu-ld: cannot find?

查看:1148
本文介绍了/usr/bin/x86_64-linux-gnu-ld:找不到?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ubuntu 18.04(gcc 7.3)中学习C语言

I study C language in ubuntu 18.04(gcc 7.3)

输入make all命令时,会发生此错误:

When the make all command is entered, this error occurrs:

/usr/bin/x86_64-linux-gnu-ld:找不到-lkeccak

/usr/bin/x86_64-linux-gnu-ld: can not find -lkeccak

Makefile如下.

CC=gcc
CFLAGS=-03 -fomit-frame-pointer -msse2avx -mavx2 -march=native -std=c99

all:
    $(CC) $(CFLAGS) -c Lizard.c main.c randombytes.c sha512.c
    $(CC) $(CFLAGS) -o Lizard Lizard.o main.o randobytes.o sha512.o -lkeccak

run: all
    ./Lizard

new:
    make clean
    make all
    ./Lizard

当前libkeccak.a文件与Makefile位于同一目录中,并且 它也在/usr/include目录中.

Currently the libkeccak.a file is in the same directory as the Makefile and it is also in the /usr/include directory.

我根本不知道解决方法.

I do not know the solution method at all.

请帮帮我.

推荐答案

-l选项用于链接动态库(如libkeccak.so).如果静态库位于标准"目录之一中,则它们已经链接到可执行文件,因此无需提供选项-lkeccak.

The -l option is for linking dynamic libraries (like libkeccak.so). Static libraries are linked into the executable already if they're in one of the "standard" directories, so there's no need to provide the option -lkeccak.

如果您想明确告诉GCC链接静态库,

If you want to explicitly tell GCC to link a static library,

gcc -l:/path/to/libkeccak.a

这篇关于/usr/bin/x86_64-linux-gnu-ld:找不到?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆