2
我被以下名称碰撞挡板的名称冲突:C++,跨越不同的命名空间
namespace mp2 {
boost::numeric::ublas::matrix_range<M>
slice(M& m, const R1& r1, const R2& r2) {
namespace ublas = boost::numeric::ublas;
ublas::range r1_(r1.begin(), r1.end()), r2_(r2.begin(), r2.end());
return ublas::matrix_range<M>(m, r1_, r2_);
}
double energy(const Wavefunction &wf) {
const Wavefunction::matrix& C = wf.coefficients();
int No = wf.occupied().size();
foreach (const Basis::MappedShell& P, basis.shells()) {
slice(C, range(No), range(P));
从克误差++ 4.4是
7 In file included from mp2.cpp:1:
8 /usr/include/boost/numeric/ublas/fwd.hpp: In function âdouble mp2::energy(const Wavefunction&)â:
9 /usr/include/boost/numeric/ublas/fwd.hpp:32: error: âboost::numeric::ublas::sliceâ is not a function,
10 ../../src/mp2/energy.hpp:98: error: conflict with âtemplate<class M, class R1, class R2> boost::numeric::ublas::matrix_range<M> mp2::slice(M&, const R1&, const R2&)â
11 ../../src/mp2/energy.hpp:123: error: in call to âsliceâ
12 /usr/include/boost/numeric/ublas/fwd.hpp:32: error: âboost::numeric::ublas::sliceâ is not a function,
13 ../../src/mp2/energy.hpp:98: error: conflict with âtemplate<class M, class R1, class R2> boost::numeric::ublas::matrix_range<M> mp2::slice(M&, const R1&, const R2&)â
14 ../../src/mp2/energy.hpp:129: error: in call to âsliceâ
15 make: *** [mp2.lo] Error 1
uBLAS库段是
namespace boost { namespace numeric { namespace ublas {
typedef basic_slice<> slice;
为什么在ublas中的切片与mp2中的切片碰撞? 我和相当肯定在代码和包含中没有using namespace ublas
。
谢谢
对不起,有一些无关的编译器消息被删除 – Anycorn 2010-06-12 06:08:12
你有使用语句吗? – 2010-06-12 07:06:56
@Dav不,我还没找到。我通过ublas包括,他们似乎也没关系 – Anycorn 2010-06-13 20:25:01