简体   繁体   English

“找不到 -lc” 通过 linux 终端编译

[英]"cannot find -lc" Compiling via linux terminal

I make a premise: I'm a "newborn" in the Linux world, I have very little experience.我做一个前提:我是Linux世界的“新生儿”,经验很少。 I decided to switch to this operating system after studying it in a university course and I fell in love with it.在大学课程中学习了这个操作系统后,我决定改用这个操作系统,我爱上了它。 Having said that, let me tell you my problem... I installed Linux Mint 21.1 initially in dual-boot with a fairly small partition size.话虽如此,让我告诉你我的问题......我最初在双引导中安装了 Linux Mint 21.1,分区大小相当小。 To extend the partition I thought of reinstalling it from 0 thus avoiding some problems that were appearing.为了扩展分区,我想到了从 0 重新安装它,从而避免出现的一些问题。 For university reasons I find myself programming and compiling from a terminal.出于大学原因,我发现自己在终端上编程和编译。 At the first installation of Linux I managed to install everything necessary and to solve the various problems that arose.在第一次安装 Linux 时,我设法安装了所有必要的东西并解决了出现的各种问题。 On reinstallation, when I try to compile a file from the terminal, I get the following message:重新安装时,当我尝试从终端编译文件时,我收到以下消息:

gcc -c procedure.c
gcc -c semafori.c
gcc -c prodcons_singolo_buffer.c
gcc -o prodcons_singolo_buffer procedure.o semafori.o prodcons_singolo_buffer.o
/usr/bin/ld: impossibile trovare -lc: File o directory non esistente
collect2: error: ld returned 1 exit status
make: *** [Makefile:4: prodcons_singolo_buffer] Errore

In particular, the error Is:特别是,错误是:

usr/bin/ld: impossibile trovare -lc: File o directory non esistente

Unfortunately I can't find anything about it on the web. Thank you all for your availability and for any response.不幸的是,我在 web 上找不到任何相关信息。感谢大家的到来和任何回复。

EDIT: This is Makefile:编辑:这是 Makefile:

    all: prodcons_singolo_buffer

prodcons_singolo_buffer: procedure.o semafori.o prodcons_singolo_buffer.o
    gcc -o prodcons_singolo_buffer procedure.o semafori.o prodcons_singolo_buffer.o

prodcons_singolo_buffer.o: prodcons_singolo_buffer.c
    gcc -c prodcons_singolo_buffer.c

procedure.o: procedure.h procedure.c
    gcc -c procedure.c

semafori.o: semafori.c semafori.h
    gcc -c semafori.c

clean:
    rm -rf *.o
    rm -rf prodcons_singolo_buffer

I agree that your compiler/library install is borked.我同意您的编译器/库安装很麻烦。

Unrelated but here is how I would write your Makefile (untested).无关,但这是我如何写你的 Makefile(未经测试)。 Let me know when you tried it out and I will delete this answer.当您尝试时请告诉我,我将删除此答案。

.PHONY: all clean

all: prodcons_singolo_buffer

prodcons_singolo_buffer: procedure.o semafori.o prodcons_singolo_buffer.o

procedure.o:  procedure.c procedure.h

semafori.o: semafori.c semafori.h

clean:
    rm -f prodcons_singolo_buffer *.o

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM