在Eclipse中启用C / C ++编译的标志(Wall,pedantic) [英] Enabling flags (Wall, pedantic) for C/C++ compilation within Eclipse

查看:74
本文介绍了在Eclipse中启用C / C ++编译的标志(Wall,pedantic)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Eclipse编写C / C ++程序。我想使用-Wall和-pedantic标志来编译我的代码。如何在Eclipse中启用这些标志,以便在我编译C / C ++程序时默认使用它们?

I am using Eclipse to write C/C++ programs. I would like to compile my code using the -Wall and -pedantic flags. How do I enable these flags within Eclipse so they are used by default whenever I compile a C/C++ program?

推荐答案

转到Eclipse->项目浏览器->您的项目->上下文菜单->属性。

Go to Eclipse -> Project Explorer -> your project -> context menu -> Properties.

出现一个对话框。在左窗格中,打开 C / C ++构建->设置。在右窗格中,确保选择选项卡工具设置->在 GCC C ++编译器下选择警告->选中所需的框。

A dialog appears. In the left pane, open "C/C++ Build" -> Settings. In the right pane, ensure that tab "Tool Settings" is selected -> Under "GCC C++ Compiler" select "Warnings" -> check the boxes that you want.

在您的情况下,您需要书呆子(-pedantic)。默认情况下,应已选中所有警告(-Wall)。您可能还需要额外警告(-Wextra)(别名为 -W)。

In your case, you want "Pedantic (-pedantic)". "All warnings (-Wall)" should already be checked by default. You may want "Extra warnings (-Wextra)" (alias "-W"), too.

这篇关于在Eclipse中启用C / C ++编译的标志(Wall,pedantic)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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