This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Compilation error with VC2010 and colPivHouseHolder

Tags: None
(comma "," separated)
linello
Registered Member
Posts
56
Karma
0
OS
This code doesn't compile under VC2010 (while under g++-4.4 everything is fine)

Code: Select all
MatrixXd A(6,6);
A.setRandom(6,6);
VectorXd b(6,1);
MatrixXd v = A.colPivHouseholderQr().solve(b);


My eigen version is 3.04 stable
Here is the error message.

On this windows machine I have boost_1.46.1 while on my linux box boost_1.46

C:\Program Files\boost\boost_1_46_1\boost/type_traits/is_function.hpp(72): error C2371: 't' : redefinition; different basic types
1> C:\Program Files\boost\boost_1_46_1\boost/type_traits/is_function.hpp(72) : see declaration of 't'
1> C:\Program Files\boost\boost_1_46_1\boost/type_traits/is_function.hpp(97) : see reference to class template instantiation 'boost::detail::is_function_impl<T>' being compiled
1> with
1> [
1> T=
1> ]
1> C:\Program Files\boost\boost_1_46_1\boost/mpl/if.hpp(63) : see reference to class template instantiation 'boost::is_function<T>' being compiled
1> with
1> [
1> T=
1> ]
1> C:\Program Files\boost\boost_1_46_1\boost/mpl/eval_if.hpp(40) : see reference to class template instantiation 'boost::mpl::if_<T1,T2,T3>' being compiled
1> with
1> [
1> T1=boost::is_function<>,
1> T2=boost::add_pointer<>,
1> T3=boost::mpl::identity<>
1> ]
1> C:\Program Files\boost\boost_1_46_1\boost/mpl/eval_if.hpp(41) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled
1> with
1> [
1> C=boost::is_function<>,
1> F1=boost::add_pointer<>,
1> F2=boost::mpl::identity<>
1> ]
1> C:\Program Files\boost\boost_1_46_1\boost/type_traits/decay.hpp(38) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled
1> with
1> [
1> C=boost::is_array<>,
1> F1=boost::mpl::identity<*>,
1> F2=boost::mpl::eval_if<boost::is_function<>,boost::add_pointer<>,boost::mpl::identity<>>
1> ]
1> c:\cygwin\home\fulvio\workspace\cncsvision\libs\eigen\eigen\src/Core/GenericPacketMath.h(293) : see reference to class template instantiation 'boost::decay<T>' being compiled
1> with
1> [
1> T=
1> ]
1> c:\cygwin\home\fulvio\workspace\cncsvision\libs\eigen\eigen\src/Core/MapBase.h(137) : see reference to function template instantiation 'Packet Eigen::internal::ploadt<__m128d,0>(const Eigen::internal::unpacket_traits<Eigen::internal::Packet2d>::type *)' being compiled
1> with
1> [
1> Packet=__m128d
1> ]
1> c:\cygwin\home\fulvio\workspace\cncsvision\libs\eigen\eigen\src/Core/Swap.h(117) : see reference to function template instantiation '__m128d Eigen::MapBase<Derived,Level>::packet<0>(__w64 int) const' being compiled
1> with
1> [
1> Derived=Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,
1> Level=0
1> ]
1> c:\cygwin\home\fulvio\workspace\cncsvision\libs\eigen\eigen\src/Core/Assign.h(422) : see reference to function template instantiation 'void Eigen::SwapWrapper<ExpressionType>::copyPacket<Derived2,1,0>(__w64 int,const Eigen::DenseBase<Derived> &)' being compiled
1> with
1> [
1> ExpressionType=Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,
1> Derived2=Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,
1> Derived=Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>
1> ]
1> c:\cygwin\home\fulvio\workspace\cncsvision\libs\eigen\eigen\src/Core/Assign.h(406) : while compiling class template member function 'void Eigen::internal::assign_impl<Derived1,Derived2,Traversal>::run(Derived1 &,const Derived2 &)'
1> with
1> [
1> Derived1=Eigen::SwapWrapper<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>>,
1> Derived2=Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,
1> Traversal=3
1> ]
1> c:\cygwin\home\fulvio\workspace\cncsvision\libs\eigen\eigen\src/Core/Assign.h(512) : see reference to class template instantiation 'Eigen::internal::assign_impl<Derived1,Derived2,Traversal>' being compiled
1> with
1> [
1> Derived1=Eigen::SwapWrapper<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>>,
1> Derived2=Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>,
1> Traversal=3
1> ]
1> c:\cygwin\home\fulvio\workspace\cncsvision\libs\eigen\eigen\src/Core/DenseBase.h(399) : see reference to function template instantiation 'Derived &Eigen::DenseBase<Derived>::lazyAssign<Eigen::Block<XprType,BlockRows,BlockCols,InnerPanel>>(const Eigen::DenseBase<Eigen::Block<XprType,BlockRows,BlockCols,InnerPanel>> &)' being compiled
1> with
1> [
1> Derived=Eigen::SwapWrapper<Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>>,
1> XprType=Eigen::Matrix<double,-1,-1>,
1> BlockRows=-1,
1> BlockCols=1,
1> InnerPanel=true
1> ]
1> c:\cygwin\home\fulvio\workspace\cncsvision\libs\eigen\eigen\src/QR/ColPivHouseholderQR.h(429) : see reference to function template instantiation 'void Eigen::DenseBase<Derived>::swap<Derived>(const Eigen::DenseBase<Derived> &,int)' being compiled
1> with
1> [
1> Derived=Eigen::Block<Eigen::Matrix<double,-1,-1>,-1,1,true>
1> ]
1> c:\cygwin\home\fulvio\workspace\cncsvision\libs\eigen\eigen\src/QR/ColPivHouseholderQR.h(373) : while compiling class template member function 'Eigen::ColPivHouseholderQR<_MatrixType> &Eigen::ColPivHouseholderQR<_MatrixType>::compute(const Eigen::Matrix<_Scalar,_Rows,_Cols> &)'
1> with
1> [
1> _MatrixType=Eigen::Matrix<double,-1,-1>,
1> _Scalar=double,
1> _Rows=-1,
1> _Cols=-1
1> ]
1> c:\cygwin\home\fulvio\workspace\cncsvision\libs\eigen\eigen\src/QR/ColPivHouseholderQR.h(527) : while compiling class template member function 'const Eigen::ColPivHouseholderQR<_MatrixType> Eigen::MatrixBase<Derived>::colPivHouseholderQr(void) const'
1> with
1> [
1> _MatrixType=Eigen::Matrix<double,-1,-1>,
1> Derived=Eigen::Matrix<double,-1,-1>
1> ]
1> c:\cygwin\home\fulvio\workspace\cncsvision\libs\eigen\eigen\src/Core/PlainObjectBase.h(66) : see reference to class template instantiation 'Eigen::MatrixBase<Derived>' being compiled
1> with
1> [
1> Derived=Eigen::Matrix<double,-1,-1>
1> ]
1> c:\cygwin\home\fulvio\workspace\cncsvision\libs\eigen\eigen\src/Core/Matrix.h(142) : see reference to class template instantiation 'Eigen::PlainObjectBase<Derived>' being compiled
1> with
1> [
1> Derived=Eigen::Matrix<double,-1,-1>
1> ]
1> ..\..\..\workspace\cncsvision\experiments\expGiovanni\StimTwoPlanesTrans\expPassiveTwoPlanesRelativeSlant.cpp(634) : see reference to class template instantiation 'Eigen::Matrix<_Scalar,_Rows,_Cols>' being compiled
1> with
1> [
1> _Scalar=double,
1> _Rows=-1,
1> _Cols=-1
1> ]


Thank you!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
this is clearly a bug on VC2010 since it fails on the supposed re-declaration of a local variable. Perhaps you could try to separate Eigen and boost code to workaround the problem.
linello
Registered Member
Posts
56
Karma
0
OS
I can't separate it...

A simple main of this kind doesn't compile, only because boost is in the included directory!

Code: Select all
#include <Eigen/Dense>
using namespace Eigen;

int main(void)
{
         
        MatrixXd A(6,6);
   A.setRandom(6,6);
   VectorXd b(6,1);
   MatrixXd velocitiesMoving = A.partialPivLu().solve(b);
        //or pivHouseholderQr() the error is the same

   return 0;
}


The problem is that I must include boost in my project...what is the typical method to separate from boost? (if this makes sense..)
linello
Registered Member
Posts
56
Karma
0
OS
I probably solved the issue.

The problem was caused by the directive

using namespace boost::filesystem;

in another part of the code.

The solution is to specify for every function in the namespace boost::filesystem its complete signature, for example:

boost::filesystem::exists( bla bla bla)

instead of using that namespace globally...
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
hm I don't get it, you say that even without #include of boost, but only by adding boot/ in the include path you get the error? That does not make sense. Also I don't understand then how removing "using namespace boost::filesystem;" could fix the issue since there is no such directive in your example.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]