recommending compiler flag options for beginer

What would be the compiler flag options to identify errors and dangerous warnings for g++?

Thanks
Like -Wall?

man gcc for more information.
I used that but it wasn't good enough. I read the man gcc but there are too many options. I was kind of hoping some gurus would assist me with the response...

I defined a method in the header file but didn't provide the implementation in the cpp file. The compiler happily compiled the code. What options should I use to make the compiler flag that as error?

Another example,

class foo{
public:
bool run();
};

and in the cpp file

#include "foo.h"

....
bool run(){ //note that there is a typo with no scope like bool foo::run()

}

......

The compiler displayed error messages which are un-related to the real issue. It took me over an hour to scan through my codes and fixed that.

Last edited on
The problem is that what you typed is completely legal. To the compiler, it looks like run() is a free function that you
are implementing in the .cpp file. It doesn't know that what you really meant was "foo::run".
Would the compiler know that the method bool run() has been declared in the header but not the implementation?

Would you recommend some useful flag options?
Would the compiler know that the method bool run() has been declared in the header but not the implementation?

I am guessing that is what the error message you got was about. Strictly speaking it would be a link error. Only the linker can detect that you failed to implement what you told the compiler you were going to.
Topic archived. No new replies allowed.