如何在Ubuntu中安装clang格式? [英] How can I install clang-format in Ubuntu?

查看:79
本文介绍了如何在Ubuntu中安装clang格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用clang-tools(特别是clang-format)在vim中进行自动代码格式化,但是我无法通过apt-get搜索找到该工具.

I am trying to use clang-tools in particular clang-format for automatic code formatting in vim but I couldn't find this tool with apt-get search.

以前有没有人遇到过这个问题,您有什么建议吗?

Is there anybody experienced this problem before, do you have any suggestion?

推荐答案

clang格式在ubuntu-precise 12.04中不可用,但在ubuntu中可用.saucy http://packages.ubuntu.com/saucy/clang-format-3.4 .

clang-format is not available in the ubuntu-precise 12.04 but it is available in ubuntu saucy http://packages.ubuntu.com/saucy/clang-format-3.4.

为了找到带有apt-cache的软件包,我们必须将以下列表添加到我们的存储库列表中.实际上,以下列表是针对新加坡服务器生成的,但是如果您要查找自己的国家/地区,则可以使用 http://repogen.simplylinux.ch/generate.php

in order to find this package with the apt-cache we have to add below list into our repository list. Actually below list is generated for the singapore servers but if you want to look for your own country you can use http://repogen.simplylinux.ch/generate.php

生成列表后,必须将它们添加到存储库中,您可以通过查看此处来了解如何进行操作. https://help.ubuntu.com/community/Repositories/CommandLine

After generating your list, you have to add them into your repository, you can learn how to do that by looking to here. https://help.ubuntu.com/community/Repositories/CommandLine

软件包列表为;

deb http://sg.archive.ubuntu.com/ubuntu/ saucy main restricted universe multiverse 

deb-src http://sg.archive.ubuntu.com/ubuntu/ saucy main restricted universe multiverse 

deb http://sg.archive.ubuntu.com/ubuntu/ saucy-security main restricted universe multiverse 

deb http://sg.archive.ubuntu.com/ubuntu/ saucy-updates main restricted universe multiverse 

deb http://sg.archive.ubuntu.com/ubuntu/ saucy-proposed main restricted universe multiverse 

deb http://sg.archive.ubuntu.com/ubuntu/ saucy-backports main restricted universe    multiverse 

deb-src http://sg.archive.ubuntu.com/ubuntu/ saucy-security main restricted universe multiverse 

deb-src http://sg.archive.ubuntu.com/ubuntu/ saucy-updates main restricted universe multiverse 

deb-src http://sg.archive.ubuntu.com/ubuntu/ saucy-proposed main restricted universe multiverse 

deb-src http://sg.archive.ubuntu.com/ubuntu/ saucy-backports main restricted universe multiverse 

然后您应该首先使用以下命令搜索clang格式

Then you should search clang-format with below command first

sudo apt-cache搜索clang格式

sudo apt-cache search clang-format

然后,您可以安装要安装的版本,例如;

Then, you can install which version you want to install such as;

sudo apt-get install clang-format-3.3

sudo apt-get install clang-format-3.3

这篇关于如何在Ubuntu中安装clang格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆