简体   繁体   中英

Using Boost library with Borland C++ Command Line Tool

I have problem in compiling C++ code containing boost (1.55.0) using Borland C++ Command Line Tool (Borland C++ 5.5.1 for Win32).

I test the example from Boost Getting Started page, example.cpp:

#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>

int main()
{
    using namespace boost::lambda;
    typedef std::istream_iterator<int> in;

    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " " );
    return 0;
}

I have modified the bcc32.cfg file to include the boost headers as follows:

-I"c:\Borland\Bcc55\include"
-I"C:\boost_1_55_0"
-L"c:\Borland\Bcc55\lib"

Then, I try to compile using bcc32 example.cpp , getting the following errors:

Error E2221 C:\boost_1_55_0\boost/static_assert.hpp 62: Macro argument syntax error
Error E2221 C:\boost_1_55_0\boost/static_assert.hpp 182: Macro argument syntax error
Error E2238 C:\boost_1_55_0\boost/tuple/detail/tuple_basic.hpp 429: Multiple declaration for 'length<tuple<null_type,null_type,null_type,null_type,null_type,null_type,null_type,null_type,null_type,null_type> >'
Error E2344 C:\boost_1_55_0\boost/tuple/detail/tuple_basic.hpp 424: Earlier declaration of 'length<tuple<null_type,null_type,null_type,null_type,null_type,null_type,null_type,null_type,null_type,null_type> >'
Error E2238 C:\boost_1_55_0\boost/tuple/detail/tuple_basic.hpp 439: Multiple declaration for 'length<null_type>'
Error E2344 C:\boost_1_55_0\boost/tuple/detail/tuple_basic.hpp 434: Earlier declaration of 'length<null_type>'
Error E2108 C:\boost_1_55_0\boost/tuple/detail/tuple_basic.hpp 700: Improper use of typedef 'detail::ignore_t'
Error E2299 C:\boost_1_55_0\boost/tuple/detail/tuple_basic.hpp 700: Cannot generate template specialization from 'make_tuple_traits<T>'
Error E2321 C:\boost_1_55_0\boost/tuple/detail/tuple_basic.hpp 702: Declaration does not specify a tag or an identifier
Error E2108 C:\boost_1_55_0\boost/tuple/detail/tuple_basic.hpp 832: Improper use of typedef 'ignore_t'
Error E2299 C:\boost_1_55_0\boost/tuple/detail/tuple_basic.hpp 832: Cannot generate template specialization from 'tie_traits<T>'
Error E2321 C:\boost_1_55_0\boost/tuple/detail/tuple_basic.hpp 834: Declaration does not specify a tag or an identifier
Error E2401 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 89: Invalid template argument list
Error E2040 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 91: Declaration terminated incorrectly
Error E2401 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 256: Invalid template argument list
Error E2040 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 257: Declaration terminated incorrectly
Error E2238 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 408: Multiple declaration for 'bind_traits<null_type>'
Error E2344 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 401: Earlier declaration of 'bind_traits<null_type>'
Error E2434 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 435: Template declaration missing template parameters ('template<...>')
Error E2238 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 435: Multiple declaration for 'bind_traits<R>'
Error E2344 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 389: Earlier declaration of 'bind_traits<R>'
Error E2108 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 440: Improper use of typedef 'Arg1'
Error E2299 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 440: Cannot generate template specialization from 'bind_traits<R>'
Error E2428 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 442: Templates must be classes or functions
Error E2108 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 445: Improper use of typedef 'Arg1' 
Error E2228 C:\boost_1_55_0\boost/lambda/detail/lambda_traits.hpp 445: Too many error or warning messages
*** 26 errors in Compile ***

Borland C++ has a lot of standard compliance issues, this is probably a futile endeavour. Boost officially dropped support for bcc32.exe 10 years ago.

C++Builder XE does come with a working version of boost, perhaps you could look into using this instead of bcc 5.5.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM