配置GCC以全局添加编译标志 [英] Configure GCC to add compile flags globally

查看:163
本文介绍了配置GCC以全局添加编译标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以配置GCC为每个项目在全局添加一些文件吗?我想暂时且仅使用以下标记来实现它: -fdiagnostics-color

Can I configure GCC to add some file globally, for every project? I want to make it temporarily and only with flags like: -fdiagnostics-color.

推荐答案

您可能会读到 GCC规范文件,并更改您的 gcc 的特定版本使用的规范文件。

You might read about GCC spec files and alter the spec file used by your particular version of gcc. But this is generally frowned upon.

通常的做法是使用 GNU make 并将 CFLAGS + = -fdiagnostics-color 添加到您的 Makefile 。带有最近足够的GCC的BTW(添加 -fdiagnostics-color 标志)甚至没有必要开始(至少通过设置 GCC_COLORS 环境变量),默认值为 -fdiagnostics-color = auto

The usual practice would be to use GNU make and add a CFLAGS += -fdiagnostics-color to your Makefile. BTW with a recent enough GCC this (adding -fdiagnostics-color flag) is not even necessary since (at least by setting your GCC_COLORS environment variable) the default is -fdiagnostics-color=auto

这篇关于配置GCC以全局添加编译标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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