使用MVS2015编译器在Qt Creator中进行编译时出现本征错误

时间:2018-10-10 11:51:36

标签: c++ qt eigen

我尝试编译使用Eigen库的项目,但得到了令人讨厌的错误和警告:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\utility:172: warning: C4244: 'initializing': conversion from 'double' to 'int', possible loss of data
D:\toolchain-master\LabelingTool\src\Polynomial\polynomial.cpp:162: see reference to function template instantiation 'std::pair<int,int>::pair<double&,double&,void,0>(_Other1,_Other2) noexcept' being compiled
with
[
    _Other1=double &,
    _Other2=double &
]
D:\toolchain-master\LabelingTool\src\Polynomial\polynomial.cpp:162: see reference to function template instantiation 'std::pair<int,int>::pair<double&,double&,void,0>(_Other1,_Other2) noexcept' being compiled
with
[
    _Other1=double &,
    _Other2=double &
]
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\utility:172: warning: C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
D:\toolchain-master\LabelingTool\src\Polynomial\polynomial.cpp:183: see reference to function template instantiation 'std::pair<float,float>::pair<double,double,void,0>(_Other1 &&,_Other2 &&) noexcept' being compiled
with
[
    _Other1=double,
    _Other2=double
]
D:\toolchain-master\LabelingTool\src\Polynomial\polynomial.cpp:183: see reference to function template instantiation 'std::pair<float,float>::pair<double,double,void,0>(_Other1 &&,_Other2 &&) noexcept' being compiled
with
[
    _Other1=double,
    _Other2=double
]
D:\toolchain-master\LabelingTool\Dependencies\eigen-eigen\Eigen\src\Core\util\BlasUtil.h:234: error: C2664: 'const double Eigen::internal::blas_traits<T>::extractScalarFactor(const XprType &)': cannot convert argument 1 from 'const Eigen::Matrix<double,-1,-1,0,-1,-1>' to 'const Eigen::GeneralProduct<Lhs,Rhs,5> &'
with
[
    T=Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>,
    XprType=Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>
]
and
[
    Lhs=Eigen::Matrix<double,-1,-1,0,-1,-1>,
    Rhs=Eigen::Matrix<double,-1,-1,0,-1,-1>
]
D:\toolchain-master\LabelingTool\Dependencies\eigen-eigen\Eigen\src\Core\util\BlasUtil.h:234: Reason: cannot convert from 'const Eigen::Matrix<double,-1,-1,0,-1,-1>' to 'const Eigen::GeneralProduct<Lhs,Rhs,5>'
with
[
    Lhs=Eigen::Matrix<double,-1,-1,0,-1,-1>,
    Rhs=Eigen::Matrix<double,-1,-1,0,-1,-1>
]
D:\toolchain-master\LabelingTool\Dependencies\eigen-eigen\Eigen\src\Core\util\BlasUtil.h:234: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
D:\toolchain-master\LabelingTool\Dependencies\eigen-eigen\Eigen\src\Core\util\BlasUtil.h:234: while compiling class template member function 'double Eigen::internal::blas_traits<Eigen::Transpose<const Derived>>::extractScalarFactor(const Eigen::Transpose<const Derived> &)'
with
[
    Derived=Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>
]
D:\toolchain-master\LabelingTool\Dependencies\eigen-eigen\Eigen\src\Core\products\GeneralMatrixMatrix.h:405: see reference to function template instantiation 'double Eigen::internal::blas_traits<Eigen::Transpose<const Derived>>::extractScalarFactor(const Eigen::Transpose<const Derived> &)' being compiled
with
[
    Derived=Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>
]
D:\toolchain-master\LabelingTool\Dependencies\eigen-eigen\Eigen\src\Core\ProductBase.h:79: see reference to class template instantiation 'Eigen::internal::blas_traits<Eigen::Transpose<const Derived>>' being compiled
with
[
    Derived=Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>
]
D:\toolchain-master\LabelingTool\Dependencies\eigen-eigen\Eigen\src\Core\products\GeneralMatrixMatrix.h:380: see reference to class template instantiation 'Eigen::ProductBase<Eigen::GeneralProduct<Lhs,Rhs,5>,Lhs,Rhs>' being compiled
with
[
    Lhs=Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>,
    Rhs=Eigen::Transpose<const Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>>
]
D:\toolchain-master\LabelingTool\src\Polynomial\polynomial.cpp:134: see reference to class template instantiation 'Eigen::GeneralProduct<Lhs,Rhs,5>' being compiled
with
[
    Lhs=Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>,
    Rhs=Eigen::Transpose<const Eigen::GeneralProduct<Eigen::Matrix<double,-1,-1,0,-1,-1>,Eigen::Matrix<double,-1,-1,0,-1,-1>,5>>
]
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:824: warning: C4018: '<': signed/unsigned mismatch
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:958: warning: C4018: '<': signed/unsigned mismatch
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:1050: warning: C4100: 'fileName': unreferenced formal parameter
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:1074: warning: C4018: '<': signed/unsigned mismatch
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:1080: warning: C4018: '<': signed/unsigned mismatch
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:1092: warning: C4018: '<': signed/unsigned mismatch
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:1136: warning: C4100: 'position': unreferenced formal parameter
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:1391: warning: C4018: '<': signed/unsigned mismatch
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:1396: warning: C4018: '<': signed/unsigned mismatch
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:1613: warning: C4018: '<': signed/unsigned mismatch
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:1650: warning: C4018: '<': signed/unsigned mismatch
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:1673: warning: C4018: '<=': signed/unsigned mismatch
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:2392: warning: C4018: '<': signed/unsigned mismatch
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:2433: warning: C4018: '<': signed/unsigned mismatch
D:\toolchain-master\LabelingTool\src\ImageView\imageview.cpp:3523: warning: C4018: '<': signed/unsigned mismatch

问题是我不知道本项目使用的是什么版本的eigen或代码是否存在其他问题,如果有人可以解决,我将很高兴。在此项目配置中,我使用Eigen 3.2 -rc1版本。

0 个答案:

没有答案