首页 > 解决方案 > /usr/bin/x86_64-linux-gnu-ld: cannot find?

问题描述

I study C language in ubuntu 18.04(gcc 7.3)

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

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

The Makefile is as follows.

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

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.

Please, Help me.

标签: cubuntumakefileld

解决方案


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

如果你想明确告诉 GCC 链接一个静态库,

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

推荐阅读