2

Boost Test Unit を使用して非常に単純なプログラムをコンパイルしようとしています

#define BOOST_TEST_MODULE My Test
#include <boost/test/included/unit_test.hpp>

BOOST_AUTO_TEST_CASE(first_test) {   int i = 1;   BOOST_CHECK(i == 1); }

この小さなプログラムをパラメーターなしでコンパイルすると、

g++ test1.cpp

大丈夫。しかし、C++11標準を使おうとすると、

g++ test1.cpp -std=c++11

いくつかのエラーが発生します:

In file included from /usr/include/boost/test/included/unit_test.hpp:19:0,
                 from test1.cpp:2: /usr/include/boost/test/impl/debug.ipp: En la función ‘const char* boost::debug::{anónimo}::prepare_gdb_cmnd_file(const boost::debug::dbg_startup_info&)’: /usr/include/boost/test/impl/debug.ipp:426:23: error: ‘::mkstemp’ no se ha declarado
     fd_holder cmd_fd( ::mkstemp( cmd_file_name ) );
                       ^ In file included from /usr/include/boost/test/included/unit_test.hpp:19:0,
                 from test1.cpp:2: /usr/include/boost/test/impl/debug.ipp: En la función ‘bool boost::debug::attach_debugger(bool)’: /usr/include/boost/test/impl/debug.ipp:863:34: error: ‘::mkstemp’ no se ha declarado
     fd_holder init_done_lock_fd( ::mkstemp( init_done_lock_fn ) );
                                  ^ In file included from /usr/include/boost/test/utils/runtime/cla/dual_name_parameter.hpp:19:0,
                 from /usr/include/boost/test/impl/unit_test_parameters.ipp:31,
                 from /usr/include/boost/test/included/unit_test.hpp:33,
                 from test1.cpp:2: /usr/include/boost/test/utils/runtime/config.hpp: En la función ‘void boost::runtime::putenv_impl(boost::runtime::cstring, boost::runtime::cstring)’: /usr/include/boost/test/utils/runtime/config.hpp:95:51: error: ‘putenv’ no se declaró en este ámbito
     putenv( const_cast<char*>( fs.str().c_str() ) );

(コンパイラはスペイン語です)

私は使用しています:

  • Cygwin 64 ビット

  • Cygwin の Boost 1.59

  • Cygwin の G++ 4.9.3

どんな助けでも大歓迎です。ありがとう。ホセ.-

4

1 に答える 1