【发布时间】:2012-09-13 16:34:59
【问题描述】:
启动错误,通过构建以下代码显示:
Testfile.cpp:27:41: error: variable ‘boost::numeric::ublas::matrix_column<boost::numeric::ublas::bounded_matrix<double, 2u, 2u> > op1’ has initialiser but incomplete type.
请参考以下代码:
//! System includes
#include <iostream>
#include <fstream>
//! Boost includes
#include <boost/lexical_cast.hpp>
#include <boost/integer/static_min_max.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/array.hpp>
int main( )
{
namespace ublas = boost::numeric::ublas;
typedef ublas::bounded_matrix<double,2,2> MatDofDdim;
typedef ublas::bounded_vector<double,2> VecDof;
MatDofDdim op;
for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
op(i,j)=i+j;
}
}
//VecDof op1;
ublas::matrix_column<MatDofDdim> op1 ( op, 1 ) ;
//VecDof op1( ublas::matrix_column<MatDofDdim>( op, 1 ));
return 0;
}
我还尝试了一种不同的方法,将"ublas::matrix_column<MatDofDdim> op1 ( op, 1 ) ;" 行注释掉,并取消注释前面和后面的行。
然后它说:
Testfile.cpp:29:48: error: redeclaration of ‘VecDof op1’
Testfile.cpp:26:9: error: ‘VecDof op1’ previously declared here
Testfile.cpp:29:54: error: invalid use of incomplete type ‘struct boost::numeric::ublas::matrix_column<boost::numeric::ublas::bounded_matrix<double, 2u, 2u> >’
/usr/include/boost/numeric/ublas/fwd.hpp:75:11: error: declaration of ‘struct boost::numeric::ublas::matrix_column<boost::numeric::ublas::bounded_matrix<double, 2u, 2u> >’
我在ubuntu 和g++ 中使用eclipse。
【问题讨论】:
-
matrix_column在<boost/numeric/ublas/matrix_proxy.hpp>中声明 -
你是对的,它现在有效。非常感谢。我自己在哪里可以找到它?您建议在哪里锁定?
标签: c++ boost namespaces compiler-errors