gpt4 book ai didi

GCC 在 Alpine Linux 中找不到 stdio.h

转载 作者:行者123 更新时间:2023-12-02 07:28:00 35 4
gpt4 key购买 nike

在新的 Alpine Linux 中,我通过以下方式安装了 GCC

apk add --update-cache gcc

但仍然是一个简单的程序

#include <stdio.h>

int main(int argc, char *argv[]) {
return 0;
}

与消息一起编译

fatal error: stdio.h: No such file or directory

最佳答案

安装musl-dev(除了gcc编译器)

apk add musl-dev

您需要单独安装它,因为在 Alpine Linux 中,GCC 包不依赖于 libc-dev for good reason :

You can use gcc to compile things without libc, for example hypervisors firmware etc.

August Klein 还指出,在 Debian 中,出于同样的原因,GCC 仅推荐 libc-dev(但大多数人不这样做——不-install-recommends 无论如何)。

关于GCC 在 Alpine Linux 中找不到 stdio.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42366739/

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