Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 877
Josh Avatar asked Jul 02 '26 12:07

Josh


1 Answers

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.

like image 199
Rainer Blome Avatar answered Jul 05 '26 06:07

Rainer Blome



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!