Re: [eigen] typedef does not work

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]



Hi,

Eigen's stuff are defined in the Eigen namespace, so you have to prefix Matrix by the namespace:

typedef Eigen::Matrix<double,2,2> ABCDMatrix;

In header files this the preferred way. In implementation files you can either import the full namespace:

using namespace Eigen;

or only import a selected subset:

USING_PART_OF_NAMESPACE_EIGEN

see the first example of the tutorial:
http://eigen.tuxfamily.org/api/TutorialCore.html

cheers,
gael.


On Tue, Sep 23, 2008 at 11:04 PM, Matthias Pospiech <matthias.pospiech@xxxxxx> wrote:
I could of course use the predefinded Matrix2d, but I tried to define it on my own just to try it. However that did not work:

#ifndef ABCD_H_
#define ABCD_H_

#include <Qt/qobject.h>
#include <Eigen/Core>

typedef Matrix<double,2,2> ABCDMatrix;

class ABCD : public QObject
{
  Q_OBJECT
public:
  ABCD(QObject* parent = 0);
  virtual ~ABCD();


};
#endif


gives the following error output:

1>ABCD.cpp
1>m:\iqo\daten\dev\svn\abcd\laserdesignstudio\laserdesign\src\abcd\ABCD.h(7) : error C2143: Syntaxfehler: Es fehlt ';' vor '<'
1>m:\iqo\daten\dev\svn\abcd\laserdesignstudio\laserdesign\src\abcd\ABCD.h(7) : error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt.

Matthias





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/