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

Eigen + Boost shared_pointer + Windows 32bit

Tags: None
(comma "," separated)
Hunk
Registered Member
Posts
3
Karma
0
Hello i have a problem, when i ported my programm from linux 64bit to windows 32bit.

i have the class

Code: Select all
#ifndef Test_H_
#define Test_H_

#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <Eigen/Geometry>

#include <boost/shared_ptr.hpp>
#include <vector>

#include <ClassWithEigen.h>

class Test{
public:

      Eigen::Vector2d point;

   std::vector<Eigen::Vector2d> array:_of_directions;
   std::vector<ClassWithEigen::Vector2dPoints> points;
   void DoSomething(const Eigen::Vector2d& line_origin);
};

typedef boost::shared_ptr<Test> TestPtr;


#endif /* Test_H_ */


then i want to initialize this Test class in my main

int main(){
TestPtr test_ptr = TestPtr(new Test());
}


If i run this on my windows System i get following Error
Image

i tried all of this

Code: Select all
#define EIGEN_DONT_ALIGN_STATICALLY
#define EIGEN_DONT_VECTORIZE
#define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
#define  EIGEN_DONT_ALIGN


but i still get the runtime error above

Can u help me ?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Make sure these #define appear before including any Eigen header. #define EIGEN_DONT_ALIGN_STATICALLY should really be enough.

A better solution would be to introduce a new type:
Code: Select all
typedef Eigen::Matrix<double, 2, 1, Eigen::DontAlign> Vector2du; // 'u' for unaligned


and use Vector2du for your class members and in your STL containers, and Vector2d everywhere else. This way you don't completely give up on vectorization.
Hunk
Registered Member
Posts
3
Karma
0
ggael wrote:Make sure these #define appear before including any Eigen header. #define EIGEN_DONT_ALIGN_STATICALLY should really be enough.


i tried to use this and added this on every header at the top

Code: Select all
#ifndef TEST_H_
#define TEST_H_
#define EIGEN_DONT_ALIGN_STATICALLY

#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <Eigen/Geometry>
...


but still get this error
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
That's very strange. What if you add the following at the top of your files:
Code: Select all
#ifndef TEST_H_
#define TEST_H_

#ifdef EIGEN_CORE_H
#error eigen already included
#endif
#define EIGEN_DONT_ALIGN_STATICALLY

#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <Eigen/Geometry>
...
Hunk
Registered Member
Posts
3
Karma
0
ggael wrote:That's very strange. What if you add the following at the top of your files:
Code: Select all
#ifndef TEST_H_
#define TEST_H_

#ifdef EIGEN_CORE_H
#error eigen already included
#endif
#define EIGEN_DONT_ALIGN_STATICALLY

#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <Eigen/Geometry>
...


thank you that was helpfull

i oversiew one Eigen/Core include


Bookmarks



Who is online

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