Archive for the ‘Visual Studio’ Category

Visual Studio /VERBOSE linker option cause fake errors

April 16, 2007

I’m porting one of our projects to be compiled with Visual Studio 2003 instead of Visual C++ 6, and while doing this, I noticed that the linker has a “Show Progress” option.

I set this option to make sure I see all problems during the build. After handling all the warnings I has during the migration from VC++ 6 (due to stricter language enforcement), I ended with 6 strange errors, that didn’t really looked like errors, and disappeared when I did another build.

The first looked like this:

__thiscall std::length_error::length_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)” (??0length_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z) from …

What I suspect happened is that the verbose output had something to say about the library class used, and when the library class ends with error (length_error or _com_error), it probably matches the pattern that Visual Studio use to search for errors in the output, so Visual Studio thinks it is an error and add it to the build error count and to the Task List. Microsoft should have built a better solution that either talks directly with the compiler/linker to find out what errors it had, or has a better parser so such output will not be identified as an error.

My workaround was to set the Show Progress property to a lower degree of verbosity (/VERBOSE:LIB)

(BTW, for some reason, the MSDN documentation, also in the Visual Studio 2005 (8) documentation, explains how to set this option by going to the Command Line property page and type the setting in the Additional Options box, and not using the “Show Progress” Property of the General property page, like it does, for instance, for the Version property. Maybe it is because the “Show Progress” property allows you only to set full verbosity (/VERBOSE) or library search verbosity (/VERBOSE:LIB) but on the command line you can set more options and even then one /VERBOSE option, e.g. /VERBOSE:LIB /VERBOSE:REF. However, I think they should have mentioned the “Show Progress” property as well.)