Qtcrreator 4 (Qt5.7) on rhel 7 x86_64 添加配置astyle,美化代码配置方法

来源:互联网 发布:如何设置淘宝分流 编辑:程序博客网 时间:2024/06/06 15:35

安装配置astyle

1. 下载astyle

https://sourceforge.net/settings/mirror_choices?projectname=astyle&filename=astyle/astyle%202.05.1/astyle_2.05.1_linux.tar.gz

2. 编译

tar -xvf  astyle_2.05.1_linux.tar.gz

cd astyle/build/gcc  
  1.  make 
  2. make install                               #安装astyle到/usr/bin目录下。
  3. make clean

3. 拷贝

cp /usr/bin/astyle /opt/Qt5.7.0/

4. 设置
   1) 进入Qt Creator设置.
   2) Tools->Options.. 进入设置.
   3)左侧选Environment. 右侧选External Tools. 设置外部工具.
   4) 点击下方的add 按钮. 选add tools. 新增astyle.
   5)选中刚添加的astyle配置参数:
      执行文件: /opt/Qt5.3.0/astyle  astyle可执行文件放置到目录
      参数: --A2 --s2 %{CurrentDocument:FilePath}

     在Tools->External菜单中就出现了astyle

0 0