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

a function call cannot appear in a constant-expression

Tags: None
(comma "," separated)
johnkollman
Registered Member
Posts
2
Karma
0
This code works with windows visual studio does not on linux (ubuntu) with code blocks gcc compiler:

Code: Select all
   void States::calcIndependentStates(const MatNxN jacobian, MatNxN jacobianM)
   {

              int bodycount=0;

       for (int i=0; i < m_bodies->size(); i++)
       {
...
      Eigen::FullPivLU<Matrix<double,Dynamic,Dynamic>> flu(jacobian);
...


errors:
||=== Build: all in OMD (compiler: GNU GCC Compiler) ===|
/home/john/omd/trunk/src/States.cpp||In member function ‘void OMD::States::calcIndependentStates(OMD::MatNxN, OMD::MatNxN)’:|
/home/john/omd/trunk/src/States.cpp|232|error: ‘jacobian’ cannot appear in a constant-expression|
/home/john/omd/trunk/src/States.cpp|232|error: a function call cannot appear in a constant-expression|

any help would be appreciated.
thanks
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Either compile in C++11 (-std=c++11) or insert a space between the double ">>":
Code: Select all
Eigen::FullPivLU<Matrix<double,Dynamic,Dynamic> > flu(jacobian);
johnkollman
Registered Member
Posts
2
Karma
0
that worked, thank you.


Bookmarks



Who is online

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