Better
clang-format-14 --version
# Command 'clang-format-14' not found
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main" | sudo tee -a /etc/apt/sources.list
apt search clang-format
# clang-format-14/unknown 1:14.0.1~++20220426083040+0e27d08cdeb3
sudo apt install clang-format-14
clang-format-14 --version
# Ubuntu clang-format version 14.0.1-++20220426083040+0e27d08cdeb3
clang-format-14 to clang-format-15 (successful 2023)
clang-format-15 --version
# Command 'clang-format-15' not found, did you mean:
https://askubuntu.com/questions/1409031/how-to-use-a-more-recent-clang-format-or-clang-tidy-version-on-ubuntu-18-04
$ clang-format-15 --version
Ubuntu clang-format version 15.0.7
upgrade clang-10 to to clang-15 on 2023 (successful 2023)
sudo apt-get install clang-15
cd /usr/bin
sudo ln -sfn ../lib/llvm-15/bin/clang++ clang++
sudo ln -sfn ../lib/llvm-15/bin/clang clang
Reference
https://stackoverflow.com/questions/20756924/how-can-i-install-clang-format-in-ubuntu
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo nano
/etc/apt/sources.list
append below
# 14 deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main
deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main
sudo apt update
$ apt search clang-format Sorting... Done Full Text Search... Done arcanist-clang-format-linter/focal,focal 0.git20161021-2 all clang-format linter for Arcanist clang-format/focal 1:10.0-50~exp1 amd64 Tool to format C/C++/Obj-C code clang-format-10/focal 1:10.0.0-4ubuntu1 amd64 Tool to format C/C++/Obj-C code clang-format-11/focal-updates 1:11.0.0-2~ubuntu20.04.1 amd64 Tool to format C/C++/Obj-C code clang-format-12/focal-updates,focal-security 1:12.0.0-3ubuntu1~20.04.5 amd64 Tool to format C/C++/Obj-C code clang-format-14/unknown 1:14.0.1~++20220407063120+ec13fed5867f-1~exp1~20220407063130.115 amd64 Tool to format C/C++/Obj-C code clang-format-6.0/focal 1:6.0.1-14 amd64 Tool to format C/C++/Obj-C code clang-format-7/focal 1:7.0.1-12 amd64 Tool to format C/C++/Obj-C code clang-format-8/focal 1:8.0.1-9 amd64 Tool to format C/C++/Obj-C code clang-format-9/focal 1:9.0.1-12 amd64 Tool to format C/C++/Obj-C code
sudo apt install clang-format-14
$ clang-format-14 --version Ubuntu clang-format version 14.0.1-++20220407063120+ec13fed5867f-1~exp1~20220407063130.115
沒有留言:
張貼留言