Tôi đang cố gắng sử dụng Boost.Test trong Visual Studio 2010 và tôi đang gặp một số sự cố khi làm cho nó hoạt động. Đây là nguồn:Boost.Test trên Windows 64 bit
#include "stdafx.hpp"
#define BOOST_TEST_MODULE (main)
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE(morphology)
{
BOOST_CHECK(true);
}
stdafx.hpp
theo nghĩa đen là trống. Dự án đã được tạo ra như là một dự án C++ trống, được thiết lập để xây dựng một ứng dụng, với các thư mục được thiết lập để trỏ tới tăng tiêu đề và các lib. Tôi đang sử dụng/mục nhập để trỏ đến chức năng main
do Boost.Test cung cấp.
Dường như có một vài điều đang diễn ra. Thứ nhất, tại thời gian xây dựng, các mối liên kết báo cáo cảnh báo trên tất cả các đối tượng trong lib kiểm tra, tuyên bố "phần .CRT tồn tại; có thể có initializers tĩnh unhandled hoặc Terminators":
1>msvcprtd.lib(locale0_implib.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>morphology.obj : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(unit_test_main.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(framework.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(test_tools.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(unit_test_log.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(unit_test_suite.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(results_reporter.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(results_collector.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(unit_test_parameters.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(unit_test_monitor.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(debug.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(progress_monitor.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(plain_report_formatter.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
1>libboost_unit_test_framework-vc100-mt-gd-1_49.lib(xml_report_formatter.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
Art runtime, các tai nạn ứng dụng thử nghiệm đâu đó trong thư viện Boost.Test dưới gốc cây gọi của main
cung cấp bởi Boost.Test:
> Pentachoron.Test.exe!std::list<boost::shared_ptr<boost::runtime::cla::parameter>,std::allocator<boost::shared_ptr<boost::runtime::cla::parameter> > >::begin() Line 787 + 0x13 bytes C++
Pentachoron.Test.exe!boost::unit_test::for_each::begin<std::list<boost::shared_ptr<boost::runtime::cla::parameter>,std::allocator<boost::shared_ptr<boost::runtime::cla::parameter> > > >(const std::list<boost::shared_ptr<boost::runtime::cla::parameter>,std::allocator<boost::shared_ptr<boost::runtime::cla::parameter> > > & t, boost::mpl::bool_<1> __formal) Line 107 + 0xf bytes C++
Pentachoron.Test.exe!boost::runtime::cla::parser::operator[](boost::unit_test::basic_cstring<char const > string_id) Line 169 + 0x41 bytes C++
Pentachoron.Test.exe!boost::unit_test::runtime_config::`anonymous namespace'::retrieve_parameter<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >(boost::unit_test::basic_cstring<char const > parameter_name, const boost::runtime::cla::parser & s_cla_parser, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & default_value, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & optional_value) Line 216 + 0x34 bytes C++
Pentachoron.Test.exe!boost::unit_test::runtime_config::report_sink() Line 470 + 0x8b bytes C++
Pentachoron.Test.exe!boost::unit_test::results_reporter::`anonymous namespace'::results_reporter_impl::results_reporter_impl() Line 59 + 0x31 bytes C++
Pentachoron.Test.exe!boost::unit_test::results_reporter::`anonymous namespace'::s_rr_impl() Line 91 + 0x35 bytes C++
Pentachoron.Test.exe!boost::unit_test::results_reporter::get_stream() Line 120 + 0x5 bytes C++
Pentachoron.Test.exe!`boost::unit_test::unit_test_main'::`1'::catch$3() Line 207 + 0x5 bytes C++
msvcr100d.dll!_CallSettingFrame() Line 44 Asm
msvcr100d.dll!__CxxCallCatchBlock(_EXCEPTION_RECORD * pExcept) Line 1337 + 0x15 bytes C++
ntdll.dll!0000000077c50c21()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
Pentachoron.Test.exe!boost::unit_test::unit_test_main(boost::unit_test::test_suite * (int, char * *)* init_func, int argc, char * * argv) Line 179 C++
Pentachoron.Test.exe!main(int argc, char * * argv) Line 238 C++
kernel32.dll!000000007753652d()
ntdll.dll!0000000077c2c521()
hãy .... một ai đó cho tôi biết đó chỉ là một lá cờ biên dịch tôi đã không được thiết lập, hoặc một cái gì đó ngu ngốc như rằng ...
[Điều này có thể hữu ích trong việc giải quyết vấn đề của bạn] (http://stackoverflow.com/questions/6529003/crt-section-what-does-this-warning-mean). Trên một đường chuyền lướt qua trong Google, đây là điều tốt nhất tôi có thể tìm thấy vào lúc này. – MrGomez
Vâng, đó cũng là điều đầu tiên tôi tìm thấy. Các gợi ý MSDN không có vẻ hữu ích, bởi vì theo mặc định, ngay cả một dự án trống liên kết với các thư viện thời gian chạy C và C++. Ngoài ra, tôi đã "không sử dụng/noentry" bởi đức hạnh của việc sử dụng '/ entry'. –
Để chắc chắn - bạn đã tự xây dựng Boost? Nếu vậy, bạn đã chuyển tùy chọn nào tới bjam/b2? – ildjarn