原来使用boost 1.34的multi_array.在VC71下编译没有问题.现更新到boost 1.35.发现无法通过编译.及时文档中给出的例子也无法编译通过.各位有没有碰到类似问题.哪个错误信息看了半天也没有弄明白.还希望有了解该库的朋友帮忙看下.
这个库的例子在VC8或更高版本的编译器下
没有问题.
我的编译环境是WIN7(64位)+VS2003SP1 CL.EXE版本为13.10.6030.0
编译的例子文为/boost_1_45_0/libs/multi_array/doc/user.html
#include "stdafx.h"
#include "boost/multi_array.hpp"
#include <cassert>
int main () {
// Create a 3D array that is 3 x 4 x 2
typedef boost::multi_array<double, 3> array_type;
typedef array_type::index index;
array_type A(boost::extents[3][4][2]);
// Assign values to the elements
int values = 0;
for(index i = 0; i != 3; ++i)
for(index j = 0; j != 4; ++j)
for(index k = 0; k != 2; ++k)
A[i][j][k] = values++;
// Verify values
int verify = 0;
for(index i = 0; i != 3; ++i)
for(index j = 0; j != 4; ++j)
for(index k = 0; k != 2; ++k)
assert(A[i][j][k] == verify++);
return 0;
}
中的第一个示例代码:
编译错误为如下.
生成日志 ------- 已启动生成: 项目: multi_arrayTest,配置: Debug|Win32 -------
命令行 正在创建临时文件“r:\multi_arrayTest\Debug\RSP000003.rsp”,其内容为
[
/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /EHsc /RTC1 /RTCc /MTd /GR /Yu"stdafx.h" /Fp"Debug/multi_arrayTest.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c /Wp64 /ZI /TP
.\multi_arrayTest.cpp
]
正在创建命令行“cl.exe @r:\multi_arrayTest\Debug\RSP000003.rsp /nologo”
正在创建临时文件“r:\multi_arrayTest\Debug\RSP000004.rsp”,其内容为
[
/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Gm /EHsc /RTC1 /RTCc /MTd /GR /Yc"stdafx.h" /Fp"Debug/multi_arrayTest.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c /Wp64 /ZI /TP
.\stdafx.cpp
]
正在创建命令行“cl.exe @r:\multi_arrayTest\Debug\RSP000004.rsp /nologo”
输出窗口 正在编译...
stdafx.cpp
正在编译...
multi_arrayTest.cpp
d:\STLDIR\boost_1_45_0\boost\typeof\msvc\typeof_impl.hpp(160) : error C2027: 使用了未定义类型“<未知>”
d:\STLDIR\boost_1_45_0\boost\typeof\msvc\typeof_impl.hpp(143) : 参见“<未知>”的声明
d:\STLDIR\boost_1_45_0\boost\typeof\msvc\typeof_impl.hpp(160) : 参见对正在编译的类模板实例化“<未知>”的引用
d:\STLDIR\boost_1_45_0\boost\type_traits\common_type.hpp(121) : 参见对正在编译的类模板实例化“<未知>”的引用
d:\STLDIR\boost_1_45_0\boost\type_traits\common_type.hpp(123) : 参见对正在编译的类模板实例化“boost::type_traits_detail::common_type_2”的引用
d:\STLDIR\boost_1_45_0\boost\typeof\msvc\typeof_impl.hpp(160) : error C2955: “boost::type” : 使用类模板需要模板参数列表
d:\STLDIR\boost_1_45_0\boost\type.hpp(14) : 参见“boost::type”的声明
d:\STLDIR\boost_1_45_0\boost\typeof\msvc\typeof_impl.hpp(161) : error C2955: “boost::type” : 使用类模板需要模板参数列表
d:\STLDIR\boost_1_45_0\boost\type.hpp(14) : 参见“boost::type”的声明
d:\STLDIR\boost_1_45_0\boost\typeof\msvc\typeof_impl.hpp(161) : error C2955: “boost::type” : 使用类模板需要模板参数列表
d:\STLDIR\boost_1_45_0\boost\type.hpp(14) : 参见“boost::type”的声明
d:\STLDIR\boost_1_45_0\boost\typeof\msvc\typeof_impl.hpp(161) : error C2039: “__ctor” : 不是“boost::type”的成员
d:\STLDIR\boost_1_45_0\boost\type.hpp(14) : 参见“boost::type”的声明
d:\STLDIR\boost_1_45_0\boost\typeof\msvc\typeof_impl.hpp(161) : error C2146: 语法错误 : 缺少“;”(在标识符“type”的前面)
d:\STLDIR\boost_1_45_0\boost\typeof\msvc\typeof_impl.hpp(161) : error C2461: “<未知>” : 构造函数语法缺少形参
d:\STLDIR\boost_1_45_0\boost\typeof\msvc\typeof_impl.hpp(161) : error C2955: “boost::type” : 使用类模板需要模板参数列表
d:\STLDIR\boost_1_45_0\boost\type.hpp(14) : 参见“boost::type”的声明
d:\STLDIR\boost_1_45_0\boost\typeof\msvc\typeof_impl.hpp(161) : fatal error C1903: 无法从以前的错误中恢复;正在停止编译
结果 生成日志保存在“file://r:\multi_arrayTest\Debug\BuildLog.htm”中
multi_arrayTest - 9 错误,0 警告