Skip to content

static assertion failed: std::vector must have the same value_type as its allocator #6

@a3adam

Description

@a3adam

When compiling the code, I got the following error.

Scanning dependencies of target vortexje 
[ 27%] Building CXX object vortexje/CMakeFiles/vortexje.dir/solver.cpp.o
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/eigen3/Eigen/SparseCore:15,
                 from /usr/include/eigen3/Eigen/IterativeLinearSolvers:11,
                 from /home/adam/vortexje/vortexje/solver.cpp:23:
/usr/include/c++/9/bits/stl_vector.h: In instantiation of ‘class std::vector<std::vector<Eigen::Matrix<double, 3, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 3, 1> > >, Eigen::aligned_allocator<std::vector<Eigen::Matrix<double, 3, 1> > > >’:
/home/adam/vortexje/vortexje/solver.cpp:1003:116:   required from here
/usr/include/c++/9/bits/stl_vector.h:401:64: error: static assertion failed: std::vector must have the same value_type as its allocator
  401 |       static_assert(is_same<typename _Alloc::value_type, _Tp>::value,
      |                                                                ^~~~~
make[2]: *** [vortexje/CMakeFiles/vortexje.dir/build.make:76: vortexje/CMakeFiles/vortexje.dir/solver.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:533: vortexje/CMakeFiles/vortexje.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

The compiler versions posted when executing the cmake command are given below.

-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Eigen3: /usr/include/eigen3 (Required is at least version "3.2.2")
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.17") found components: doxygen dot
-- Configuring done
-- Generating done
-- Build files have been written to: /home/adam/vortexje/build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions