May 12, 2025 · ✎ Jun 11, 2025 · 749 views · 0 likes · 维护 GCC 该文章是由 LLM 从英文版本 翻译而来。 尽管已经做了检查和润色,仍可能存在错翻之处。 This article is part of Myriad Dreamin Blog 2025-05. §1. 列出 G++ 包 §2. build-essential §3. update-alternatives §4. 使用特定版本的 gcc §5. 检查已配置的 gcc 版本 §6. GNU 工具链目录结构 # 列出 G++ 包 sudo apt list "gcc-*" | grep -P "gcc-\d+\/" sudo apt list "g++-*" | grep -P "g++-\d+\/" sudo apt list "gcc-*" | grep -P "gcc-\d+\/" sudo apt list "g++-*" | grep -P "g++-\d+\/" sudo apt list "gcc-*" | grep -P "gcc-\d+\/" sudo apt list "g++-*" | grep -P "g++-\d+\/" sudo apt list "gcc-*" | grep -P "gcc-\d+\/" sudo apt list "g++-*" | grep -P "g++-\d+\/" # build-essential sudo apt-get install build-essential sudo apt-get install build-essential sudo apt-get install build-essential sudo apt-get install build-essential # update-alternatives sudo apt-get install update-alternatives sudo apt-get install update-alternatives sudo apt-get install update-alternatives sudo apt-get install update-alternatives # 使用特定版本的 gcc sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7 # 检查已配置的 gcc 版本 sudo update-alternatives --config gcc sudo update-alternatives --config g++ sudo update-alternatives --config gcc sudo update-alternatives --config g++ sudo update-alternatives --config gcc sudo update-alternatives --config g++ sudo update-alternatives --config gcc sudo update-alternatives --config g++ # GNU 工具链目录结构 binbin - 可执行文件 includeinclude - 头文件 liblib - 库文件 libexeclibexec - 内部使用的可执行文件 目录结构很重要,因为 gccgcc 会根据相对于 which gccwhich gcc 的路径在这些目录中查找文件。
Comments