Enabling flags (Wall, pedantic) for C/C++ compilation within Eclipse

依然范特西╮ 提交于 2019-12-10 21:37:07

问题


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?


回答1:


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

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.

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.



来源:https://stackoverflow.com/questions/9908898/enabling-flags-wall-pedantic-for-c-c-compilation-within-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!