Visual Studio 2005 编译器错误的生成输出如下所示:
|.\ut_TEMPLATE.cpp(8) : error C2065: 'x' : undeclared identifier
而 Visual Studio 2010 编译器错误在输出窗口中如下所示:
|1>ut_TEMPLATE.cpp(8): error C2065: 'x' : undeclared identifier
(编辑:查看gbjbaanb关于>1的评论。)
现在,交叉检查 BOOST_ERROR 输出的内容(如果您在后期构建步骤中有 exe,则可以使用简单的 printf 来重现):
VS 2005:
|./ut_TEMPLATE.cpp(8): error in "test_TEST": check true == false failed [1 != 0]
VS 2010:
|1> ut_TEMPLATE.cpp(10): error in "test_TEST": check true == false failed [true != false]
略有不同,但不会太大,并使用手动 printf 进一步测试:
printf("ut_TEMPLATE.cpp(00): error : in \"test_TEST\": check true == false failed [true != false]" "\n");
^^^ .. Note colon here
我们还让 VS 2010 将此输出识别为错误:
BOOST_AUTO_TEST_CASE(test_TEST)
{
printf("ut_TEMPLATE.cpp(00): error : in \"test_TEST\": check true == false failed [true != false]" "\n");
BOOST_CHECK_EQUAL( true, false);
}
1>------ Build started: Project: ut_TEMPLATE, Configuration: Release Win32 ------
1> ut_TEMPLATE.cpp
1> ut_TEMPLATE.vcxproj -> ....\UnitTests\ut_TEMPLATE\..\..\..\Release\ut_TEMPLATE.exe
1> Running 1 test case...
1>ut_TEMPLATE.cpp : error : in "test_TEST": check true == false failed [true != false]
1> ut_TEMPLATE.cpp(9): error in "test_TEST": check true == false failed [true != false]
1>C:\Programme\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command ""....\\ut_TEMPLATE.exe" --result_code=no --report_level=no
1>C:\Programme\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
看来你/我们/Boost.Test 需要调整它的输出,以便 VS2010 IDE 仍能识别错误消息。