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

aligned_allocator error with gnu++0x flag

Tags: None
(comma "," separated)
daviddoria
Registered Member
Posts
46
Karma
0
OS
With this CMakeLists.txt file:
Code: Select all
cmake_minimum_required(VERSION 2.6)

PROJECT(TestEigen)
include_directories(/media/portable/src/Eigen)

ADD_EXECUTABLE(TestEigen TestEigen.cpp)


the following code compiles fine:
Code: Select all
#include <iostream>
#include <vector>

#include <Eigen/Dense>

int main()
{
  typedef std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > Point2DVector;
  Point2DVector points(5);
 
  return 0;
}


However, with this CMakeLists.txt file:
Code: Select all
cmake_minimum_required(VERSION 2.6)

PROJECT(TestEigen)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++0x")
include_directories(/media/portable/src/Eigen)

ADD_EXECUTABLE(TestEigen TestEigen.cpp)


I get this error:

Code: Select all
error: no matching function for call to ‘Eigen::aligned_allocator<Eigen::Matrix<double, 2, 1> >::construct(Eigen::Matrix<double, 2, 1>*)’


Does anyone know how to fix this?

Thanks,

David
daviddoria
Registered Member
Posts
46
Karma
0
OS
This seems to do the trick:

Point2DVector points(5, Eigen::Vector2d());

it seems like a bug though, I have posted it here: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=455


Bookmarks



Who is online

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