使用Borland C ++命令行工具(Borland C ++ 5.5.1 for Win32)编译包含boost(1.55.0)的C ++代码时遇到问题。
我测试了Boost Getting Started页面中的示例,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;
}
我修改了 bcc32.cfg 文件以包含升级标头,如下所示:
-I"c:\Borland\Bcc55\include"
-I"C:\boost_1_55_0"
-L"c:\Borland\Bcc55\lib"
然后,我尝试使用bcc32 example.cpp
进行编译,得到以下错误:
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 ***
答案 0 :(得分:2)
Borland C ++有很多标准的合规性问题,这可能是徒劳的。 10年前,Boost正式放弃了对bcc32.exe的支持。
C ++ Builder XE确实附带了boost的工作版本,也许您可以考虑使用它来代替bcc 5.5。