Hey,
I'm trying to show all the warning messages of my c++ program, similar to a -Wall command for linux. How can I do that?
Right now I am using the command:
>: cl /EHsc myProgram.cpp
Hey,
I'm trying to show all the warning messages of my c++ program, similar to a -Wall command for linux. How can I do that?
Right now I am using the command:
>: cl /EHsc myProgram.cpp
Go to project settings and set the warning level to /W4.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Nice, thank you.
Im writting c++ code and its complaining about me using strcpy and strcmp.
Should I not use those? Is it risky?
If used incorrectly, yes. You can disable those warnings by defining the macro _CRT_SECURE_NO_WARNINGS in the project settings.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Why ARE you using strcpy etc in a C++ program?
C++ has a perfectly usable std::string class.
Even when you NEED a char array, say to open a filename, you use the c_str() method of your string.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I've been able to use the -Wall option in VC++ in 2008, and I think 2005 also. It's probably been around a while, but there's no GUI option for it, so most people don't know it exists. It's also pretty much useless because it complains a LOT about Microsoft's own libraries...
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010
There is a gui option in 2010, though. It pretty much shows all warnings, including merely informative ones. So it's not really complaining per se, but informing you more like it.
W4 is probably the best trade-off. Or you could always use All and disable some warnings. It's easy to do globally in 2010.