Makefile 高亮显示Error、Warning等错误以及警告信息
2017-02-08 10:44
711 查看
原文出处:https://my.oschina.net/bingwu/blog/788347 这可是好东西呀,感谢原作者分享!
摘要: 这是刚性需求啊! 经常性用 Makefile 编译程序,但是出错后清一色的编译输出信息让人查找错误点时一阵头大!还好GitHub上有 color_cpmpile 项目,真是造福啊!感谢此项目的原作者! GitHub上的项目地址 https://github.com/chinaran/color-compile 或者在这里下载源代码:http://pan.baidu.com/s/1kUTFtQ3 1、编译。很简单,进入项目目录里
alias g++="color_compile g++"
alias make="color_compile make" 3、配置交叉编译器。这个也是很简单,只要在 ~/.bashrc 文件末尾加入一下内容即可(这是海思编译器),也可根据格式添加自己的编译器。 # 编译时颜色输出 2016年11月15日 星期二 14:36:00 CST
alias arm-hisiv100nptl-linux-gcc="color_compile arm-hisiv100nptl-linux-gcc"
alias arm-hisiv100nptl-linux-g++="color_compile arm-hisiv100nptl-linux-g++"
alias arm-hismall-linux-gcc="color_compile arm-hismall-linux-gcc"
alias arm-hismall-linux-g++="color_compile arm-hismall-linux-g++" 4、生效。需要 source 一下让配置文件生效(也可以重新打开终端)
5、卸载或重装 a) 删除 ~/.bashrc 后面的所有添加的 alias 别名,以免造成其他未知影响。 b) 删除 /usr/local/bin/color_compile 可执行程序
摘要: 这是刚性需求啊! 经常性用 Makefile 编译程序,但是出错后清一色的编译输出信息让人查找错误点时一阵头大!还好GitHub上有 color_cpmpile 项目,真是造福啊!感谢此项目的原作者! GitHub上的项目地址 https://github.com/chinaran/color-compile 或者在这里下载源代码:http://pan.baidu.com/s/1kUTFtQ3 1、编译。很简单,进入项目目录里
$ \make /*使用的是系统的 make 来编译,而非 alias 定义的别名*/2、安装。编译完成后便是安装了(install 的工作是 copy 主程序到 /usr/local/bin 中,并向 shell 的配置文件(此处一般是 ~/.bashrc)末尾添加别名)
$ sudo \make install /*安装*/此时查看 ~/.bashrc 文件,在文件最末尾应能看到新加入的别名alias gcc="color_compile gcc"
alias g++="color_compile g++"
alias make="color_compile make" 3、配置交叉编译器。这个也是很简单,只要在 ~/.bashrc 文件末尾加入一下内容即可(这是海思编译器),也可根据格式添加自己的编译器。 # 编译时颜色输出 2016年11月15日 星期二 14:36:00 CST
alias arm-hisiv100nptl-linux-gcc="color_compile arm-hisiv100nptl-linux-gcc"
alias arm-hisiv100nptl-linux-g++="color_compile arm-hisiv100nptl-linux-g++"
alias arm-hismall-linux-gcc="color_compile arm-hismall-linux-gcc"
alias arm-hismall-linux-g++="color_compile arm-hismall-linux-g++" 4、生效。需要 source 一下让配置文件生效(也可以重新打开终端)
$ source ~/.bashrc此时再去 make 代码工程,就会发现有很多醒目的输出信息了。可以使用自带的例子查看效果
$ make TEST /* ==gcc -Wall test.c */输出如下
5、卸载或重装 a) 删除 ~/.bashrc 后面的所有添加的 alias 别名,以免造成其他未知影响。 b) 删除 /usr/local/bin/color_compile 可执行程序
$ sudo rm /usr/local/bin/color_compile
其他
1、gcc 版本为 4.9.0 以上时,可以使用 gcc 内置的高亮显示,加上参数 -fdiagnostics-color=auto 即可 2、需要修改其他颜色输出,只要修改 out_color_info.c 源码即可,里面有部分颜色的宏定义。相关文章推荐
- Makefile 高亮显示Error、Warning等错误以及警告信息
- 百篇大计敬本年之最强辅助《三》 —— Makefile 高亮显示Error、Warning等错误以及警告信息
- make only output error/warning message( 编译时,只输出错误信息和警告信息)
- Mysql error number: 2003 (MySQL错误代码以及出错信息对照大全)
- 在软件开发过程中出现的异常:警告warning、错误error
- Play Framework 错误信息显示 (error message display In play framework)
- Makefile文件调试跟踪打印警告错误信息
- 如何显示Magento 错误信息!Magento install error – Exception printing
- VC中GetLastError()获取错误信息的使用,以及错误代码的含义
- VC中GetLastError()获取错误信息的使用,以及错误代码的含义
- 在makefile中打印错误或警告信息
- 显示GetLastError函数的错误信息
- ExpandableListView的使用以及信息的高亮显示
- Delphi 调试Dll报错 通过GetLastError显示错误信息。
- openerp学习笔记 错误、警告、提示、确认信息显示
- matlab 警告(warning)、错误(error)、异常(exception)与断言(assert)
- 在makefile中打印错误或警告信息
- Windows核心编程学习笔记(1)--显示GetLastError错误的详细信息
- VC中GetLastError()获取错误信息的使用,以及错误代码的含义
- Android Studio 的Logcat不会显示Log.i,log.e以及错误信息提示的问题