如何在 WSL Debian 13 中安装 g++/gcc 开发工具包

本文详细介绍如何在WSL Debian 13 操作系统中安装gcc/g++开发工具包

分类:

Debain

gcc

g++


简介

在Debain中安装 gcc/g++ 我们会使用到 build-essential 工具包,它包含多个软件开发工具,除gcc,g++ 外,还有 make、常用的 c/c++ 头文件。

更新系统软件包信息

安装 build-essential 开发工具包,首先使用以下命令更新系统中的软件包信息:

sudo apt update

安装 build-essential

sudo apt install build-essential

验证安装

使用gcc, g++, make 后接 --verion,来确认是否安装完成及相关工具的版本信息:

iters365@DevLab:~$ gcc --version
gcc (Debian 14.2.0-19) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

iters365@DevLab:~$ g++ --version
g++ (Debian 14.2.0-19) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

iters365@DevLab:~$ make --version
GNU Make 4.4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

运行命令并出现相关的版本信息,则证明开发工具包安装成功。